diff --git a/.DS_Store b/.DS_Store index 1cf57d2e..435e16eb 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/docker-compose.yml b/docker-compose.yml index 3f209328..1adf764b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,76 +18,6 @@ services: - ./mih_nginx/letsencrypt:/etc/letsencrypt networks: - mih-network -#============== GITEA ==================================================================== - mih-gitea: - image: gitea/gitea:latest - container_name: mih-gitea - environment: - - USER_UID=1000 - - USER_GID=1000 - - GITEA__database__DB_TYPE=mysql - - GITEA__database__HOST=mih-gitea-db:3306 - - GITEA__database__NAME=${GITEA_SQL_DB} - - GITEA__database__USER=${GITEA_SQL_USER} - - GITEA__database__PASSWD=${GITEA_SQL_PW} - restart: always - networks: - - mih-network - volumes: - - ./mih_git/gitea:/data - - /etc/timezone:/etc/timezone:ro - - /etc/localtime:/etc/localtime:ro - ports: - - "127.0.0.1:3000:3000" - - "127.0.0.1:222:22" - depends_on: - mih-gitea-db: - condition: service_healthy - mih-gitea-db: - image: mysql:8.0 - container_name: mih-gitea-db - restart: always - environment: - - MYSQL_ROOT_PASSWORD=${GITEA_SQL_ROOT_PW} - - MYSQL_USER=${GITEA_SQL_USER} - - MYSQL_PASSWORD=${GITEA_SQL_PW} - - MYSQL_DATABASE=${GITEA_SQL_DB} - networks: - - mih-network - volumes: - - ./mih_git/mysql:/var/lib/mysql - healthcheck: - test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] - interval: 10s - timeout: 5s - retries: 5 - #============== Super Token Auth ==================================================================== - mih-supertokens: - container_name: mih-supertokens - image: supertokens/supertokens-mysql:latest - depends_on: - - mih-db - ports: - - '127.0.0.1:3567:3567' - environment: - REFRESH_TOKEN_VALIDITY: '604800' - ACCESS_TOKEN_VALIDITY: '86400' - PASSWORD_RESET_TOKEN_LIFETIME: '7200000' - MYSQL_USER: ${SQL_USER} - MYSQL_PASSWORD: ${SQL_USER_PW} - MYSQL_HOST: mih-db - MYSQL_PORT: 3306 - MYSQL_DATABASE_NAME: ${SUPERTOKENS_DB} - API_KEYS: ${SUPERTOKENS_API_KEY} - networks: - - mih-network - restart: unless-stopped - healthcheck: - test: > - bash -c 'exec 3<>/dev/tcp/127.0.0.1/3567 && echo -e "GET /hello HTTP/1.1\r\nhost: 127.0.0.1:3567\r\nConnection: close\r\n\r\n" >&3 && cat <&3 | grep "Hello"' - interval: 10s - timeout: 5s - retries: 5 #============== MIH WordPress ==================================================================== mih-wordpress: container_name: mih-wordpress @@ -117,81 +47,6 @@ services: - ./mih_wp/database:/var/lib/mysql networks: - mih-network - #============== MIH-UX Flutter ==================================================================== - mih-ux: - container_name: mih-ux - build: - context: ./mih_ui - ports: - - "127.0.0.1:83:83" - networks: - - mih-network - depends_on: - - mih-api-hub - #============== API Hub ==================================================================== - mih-api-hub: - build: - context: ./mih_api_hub - target: builder - container_name: mih-api-hub - ports: - - "127.0.0.1:8080:80" - volumes: - - ./mih_api_hub:/app - networks: - - mih-network - depends_on: - - mih-db - #============== My SQL DB ==================================================================== - mih-db: - platform: linux/amd64 - image: mysql:5.7 - container_name: mih-db - restart: always - environment: - MYSQL_ROOT_PASSWORD: ${SQL_ROOT_PW} - MYSQL_USER: ${SQL_USER} - MYSQL_PASSWORD: ${SQL_USER_PW} - MYSQL_DATABASE: ${SUPERTOKENS_DB} - networks: - - mih-network - ports: - - '127.0.0.1:3306:3306' - volumes: - - ./mih_db:/var/lib/mysql - #============== PHP My Admin ==================================================================== - # phpmyadmin: - # platform: linux/amd64 - # image: phpmyadmin/phpmyadmin - # container_name: MIH-phpmyadmin - # environment: - # PMA_HOST: mih-db - # PMA_PORT: 3306 - # PMA_ARBITRARY: - # networks: - # - mih-network - # restart: always - # ports: - # - 8081:80 - # depends_on: - # - mih-db - #============== Minio File Storage ==================================================================== - mih-minio: - platform: linux/amd64 - container_name: mih-minio - hostname: mih-minio - image: minio/minio - ports: - - '127.0.0.1:9000:9000' - - '127.0.0.1:9001:9001' - volumes: - - './mih_minio:/data' - environment: - MINIO_ROOT_USER: ${MINIO_ROOT_USER} - MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PW} - networks: - - mih-network - command: ["server", "/data", "--console-address", ":9001"] #============== MIH-Monitor Portainer ==================================================================== mih-monitor: container_name: mih-monitor @@ -203,49 +58,4 @@ services: - /var/run/docker.sock:/var/run/docker.sock restart: unless-stopped networks: - - mih-network - #============== MIH-AI Ollama ==================================================================== - mih-ai: - container_name: mih-ai - image: ollama/ollama:latest - ports: - - '127.0.0.1:11434:11434' - volumes: - - ./mih_ai/ollama/ollama:/root/.ollama - pull_policy: always - tty: true - restart: always - environment: - - OLLAMA_ORIGINS=* - - OLLAMA_KEEP_ALIVE=24h - - OLLAMA_HOST=0.0.0.0 - networks: - - mih-network -# === Added section for NVIDIA GPU acceleration === - # runtime: nvidia - # deploy: - # resources: - # reservations: - # devices: - # - driver: nvidia - # count: all # or specify a number of GPUs - # capabilities: [ gpu ] -#============== Firebaase ==================================================================== -# firebase: -# container_name: MIH-firebase-emulator -# build: -# context: ./Firebase-emulator -# environment: -# DATA_DIRECTORY: "firebase/data" -# FIREBASE_PROJECT: "mzansi-innovation-hub" -# ports: -# - 8082:8080 # FIRESTORE_PORT -# - 5005:5005 # FIRESTORE_WS_PORT -# - 4000:4000 # UI_PORT -# - 9099:9099 # AUTH_PORT -# - 5000:6001 # Hosting -# volumes: -# - ./Firebase-emulator:/srv/firebase:rw -# # - ./cache:/root/.cache/:rw -# # - ~/.config/:/root/.config -# - ./Firebase-emulator/firebase/data:/srv/firebase/data:rw + - mih-network \ No newline at end of file diff --git a/mih_ai/.gitignore b/mih_ai/.gitignore deleted file mode 100644 index 57115811..00000000 --- a/mih_ai/.gitignore +++ /dev/null @@ -1 +0,0 @@ -ollama/ollama diff --git a/mih_api_hub/.DS_Store b/mih_api_hub/.DS_Store deleted file mode 100644 index 510f15ab..00000000 Binary files a/mih_api_hub/.DS_Store and /dev/null differ diff --git a/mih_api_hub/.gitignore b/mih_api_hub/.gitignore deleted file mode 100644 index fb1147e5..00000000 --- a/mih_api_hub/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.env -__pycache__/ -temp*.pdf -.DS_Store \ No newline at end of file diff --git a/mih_api_hub/Dockerfile b/mih_api_hub/Dockerfile deleted file mode 100644 index dfd1da3d..00000000 --- a/mih_api_hub/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -FROM tiangolo/uvicorn-gunicorn-fastapi:latest AS builder -# FROM tiangolo/uvicorn-gunicorn-fastapi:python3.11-slim AS builder - -WORKDIR /app - -COPY requirements.txt ./ -RUN --mount=type=cache,target=/root/.cache/pip \ - pip --default-timeout=120 install -r requirements.txt - -# COPY . ./app - -# FROM builder as dev-envs - -# RUN <" - ) - -class Business(Base): - __tablename__ = 'business' - __table_args__ = {'schema': 'app_data'} - idbusiness = Column(Integer, primary_key=True) - business_id = Column(String(128), nullable=False, unique=True) - Name = Column(String(128)) - type = Column(String(128)) - registration_no = Column(String(128)) - logo_name = Column(String(128)) - logo_path = Column(String(128)) - contact_no = Column(String(45)) - bus_email = Column(String(128)) - gps_location = Column(String(128)) - practice_no = Column(String(45)) - vat_no = Column(String(45)) - website = Column(String(128)) - rating = Column(String(45), server_default="''") # Changed to match image default - mission_vision = Column(String(256)) - - def __repr__(self): - return ( - f"" - ) - -class BusinessRating(Base): - __tablename__ = 'business_ratings' - __table_args__ = {'schema': 'mzansi_directory'} - idbusiness_ratings = Column(Integer, primary_key=True) - app_id = Column(String(128), nullable=False, server_default="") - business_id = Column(String(128), nullable=False, server_default="") - rating_title = Column(String(128), nullable=False, server_default="") - rating_description = Column(String(256), nullable=False, server_default="") - rating_score = Column(String(45), nullable=False, server_default="") - date_time = Column(DateTime, nullable=True) - def __repr__(self): - return ( - f"" - ) -class BookmarkedBusiness(Base): - __tablename__ = 'bookmarked_businesses' - __table_args__ = {'schema': 'mzansi_directory'} - idbookmarked_businesses = Column(Integer, primary_key=True) - app_id = Column(String(128), nullable=False, server_default="") - business_id = Column(String(128), nullable=False, server_default="") - created_date = Column(DateTime, nullable=True) - def __repr__(self): - return ( - f"" - ) - - -class UserConsent(Base): - __tablename__ = 'user_consent' - __table_args__ = {'schema': 'app_data'} - iduser_consent = Column(Integer, primary_key=True) - app_id = Column(String(128), nullable=False,server_default=text("''")) - privacy_policy_accepted = Column(DateTime, nullable=True) - terms_of_services_accepted = Column(DateTime, nullable=True) - - def __repr__(self): - return ( - f"" - ) - -class MineSweeperLeaderboard(Base): - __tablename__ = 'player_score' - __table_args__ = {'schema': 'minesweeper_leaderboard'} - idplayer_score = Column(Integer, primary_key=True) - app_id = Column(String(128), nullable=False,server_default=text("''")) - difficulty = Column(String(45), nullable=False,server_default=text("''")) - game_time = Column(String(45), nullable=False,server_default=text("''")) - game_score = Column(DECIMAL(45), nullable=False) - played_date = Column(DateTime, nullable=True) - - def __repr__(self): - return ( - f"" - ) \ No newline at end of file diff --git a/mih_api_hub/requirements.txt b/mih_api_hub/requirements.txt deleted file mode 100644 index f3fd0d07..00000000 --- a/mih_api_hub/requirements.txt +++ /dev/null @@ -1,13 +0,0 @@ -fastapi -uvicorn -sqlalchemy -mysql-connector-python -minio -reportlab -requests -watchfiles -python-multipart -python-dotenv -xlrd -supertokens-python==0.24.0 -sniffio \ No newline at end of file diff --git a/mih_api_hub/routers/__init__.py b/mih_api_hub/routers/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/mih_api_hub/routers/access_request.py b/mih_api_hub/routers/access_request.py deleted file mode 100644 index 2424ee1e..00000000 --- a/mih_api_hub/routers/access_request.py +++ /dev/null @@ -1,130 +0,0 @@ -import mysql.connector -from fastapi import APIRouter, HTTPException -from pydantic import BaseModel -#from ..mih_database import dbConnection -import mih_database -from datetime import date -#SuperToken Auth from front end -from supertokens_python.recipe.session.framework.fastapi import verify_session -from supertokens_python.recipe.session import SessionContainer -from fastapi import Depends - -router = APIRouter() - -class accessUpdateRequest(BaseModel): - business_id: str - app_id: str - date_time: str - access: str - -class accessExtensionRequest(BaseModel): - business_id: str - app_id: str - date_time: str - revoke_date: str - -# class queueInsertRequest(BaseModel): -# business_id: str -# app_id: str -# date: str -# time: str -# access: str - -@router.get("/access-requests/{app_id}", tags=["Access Requests"]) -async def read_all_access_request_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "SELECT patient_queue.idpatient_queue, patient_queue.business_id, " - query += "patient_queue.app_id, patient_queue.date_time, patient_queue.access, patient_queue.revoke_date, " - query += "business.Name, business.type, business.logo_path, business.contact_no " - query += "from patient_manager.patient_queue " - query += "inner join app_data.business " - query += "on patient_queue.business_id = business.business_id " - query += "where app_id = %s ORDER BY date_time DESC" - cursor.execute(query, (app_id,)) - items = [ - { - "idpatient_queue": item[0], - "business_id": item[1], - "app_id": item[2], - "date_time": item[3], - "access": item[4], - "revoke_date": item[5], - "Name": item[6], - "type": item[7], - "logo_path": item[8], - "contact_no": item[9], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - -@router.put("/access-requests/update/", tags=["Access Requests"]) -async def Update_access_request_approcal(itemRequest : accessUpdateRequest): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "update patient_queue " - query += "set access=%s" - query += "where business_id=%s " - query += "and app_id=%s " - query += "and date_time=%s " - userData = (itemRequest.access, - itemRequest.business_id, - itemRequest.app_id, - itemRequest.date_time) - try: - cursor.execute(query, userData) - except Exception as error: - raise HTTPException(status_code=404, detail=error) - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Updated Record"} - -@router.put("/access-requests/extension/", tags=["Access Requests"]) -async def Update_access_request_approcal(itemRequest : accessExtensionRequest): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "update patient_queue " - query += "set access=%s, revoke_date=%s" - query += "where business_id=%s " - query += "and app_id=%s " - query += "and date_time=%s " - userData = ("pending", - itemRequest.revoke_date, - itemRequest.business_id, - itemRequest.app_id, - itemRequest.date_time) - try: - cursor.execute(query, userData) - except Exception as error: - raise HTTPException(status_code=404, detail=error) - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Updated Record"} - -# # Get List of all files -# @router.get("/files/patients/", tags="patients_files") -# async def read_all_files(session: SessionContainer = Depends(verify_session())): -# db = mih_database.dbConnection.dbPatientManagerConnect() -# cursor = db.cursor() -# query = "SELECT * FROM patient_files" -# cursor.execute(query) -# items = [ -# { -# "idpatient_files": item[0], -# "file_path": item[1], -# "file_name": item[2], -# "patient_id": item[3], -# "insert_date": item[4], -# } -# for item in cursor.fetchall() -# ] -# cursor.close() -# db.close() -# return items diff --git a/mih_api_hub/routers/appointments.py b/mih_api_hub/routers/appointments.py deleted file mode 100644 index cfe4b97e..00000000 --- a/mih_api_hub/routers/appointments.py +++ /dev/null @@ -1,157 +0,0 @@ -import mysql.connector -from fastapi import APIRouter, HTTPException -from pydantic import BaseModel -#from ..mih_database import dbConnection -import mih_database -from datetime import datetime, timedelta, date -#SuperToken Auth from front end -from supertokens_python.recipe.session.framework.fastapi import verify_session -from supertokens_python.recipe.session import SessionContainer -from fastapi import Depends - -router = APIRouter() - -class appointmentInsertRequest(BaseModel): - app_id: str - business_id: str - title: str - description: str - date: str - time: str - -class appointmentUpdateRequest(BaseModel): - idappointments: int - title: str - description: str - date: str - time: str - -class appointmentDeleteRequest(BaseModel): - idappointments: int - -# Get List of all files by patient -@router.get("/appointments/business/{business_id}", tags=["Appointments"]) -async def read_all_appointments_by_business_id(business_id: str, date: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbMzansiCalendarConnect() - requestDate = datetime.strptime(date, '%Y-%m-%d').date() - cursor = db.cursor() - query = "SELECT appointments.idappointments, appointments.app_id, " - query += "appointments.business_id, appointments.date_time, " - query += "appointments.title, appointments.description " - query += "from mzansi_calendar.appointments " - query = query + "where appointments.business_id = %s and date_time like '" + str(requestDate) + "%' " - query += "ORDER BY date_time ASC" - cursor.execute(query, (business_id,)) - items = [ - { - "idappointments": item[0], - "app_id": item[1], - "business_id": item[2], - "date_time": item[3], - "title": item[4], - "description": item[5], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - -# Get List of all files by patient -@router.get("/appointments/personal/{app_id}", tags=["Appointments"]) -async def read_all_appointments_by_business_id(app_id: str, date: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbMzansiCalendarConnect() - requestDate = datetime.strptime(date, '%Y-%m-%d').date() - cursor = db.cursor() - query = "SELECT appointments.idappointments, appointments.app_id, " - query += "appointments.business_id, appointments.date_time, " - query += "appointments.title, appointments.description " - query += "from mzansi_calendar.appointments " - query = query + "where appointments.app_id = %s and date_time like '" + str(requestDate) + "%' " - query += "ORDER BY date_time ASC" - - cursor.execute(query, (app_id,)) - items = [ - { - "idappointments": item[0], - "app_id": item[1], - "business_id": item[2], - "date_time": item[3], - "title": item[4], - "description": item[5], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - -# Insert Patient note into table -@router.post("/appointment/insert/", tags=["Appointments"], status_code=201) -async def insert_appointment(itemRequest : appointmentInsertRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - date_time = itemRequest.date + " " + itemRequest.time + ":00" - db = mih_database.dbConnection.dbMzansiCalendarConnect() - cursor = db.cursor() - query = "insert into appointments " - query += "(app_id, business_id, title, description, date_time) " - query += "values (%s, %s, %s, %s, %s)" - notetData = (itemRequest.app_id, - itemRequest.business_id, - itemRequest.title, - itemRequest.description, - date_time, - ) - try: - cursor.execute(query, notetData) - except Exception as error: - #raise HTTPException(status_code=404, detail="Failed to Create Record") - return {"message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Created file Record"} - -# Update Patient on table -@router.put("/appointment/update/", tags=["Appointments"]) -async def Update_appointment(itemRequest : appointmentUpdateRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - - date_time = itemRequest.date + " " + itemRequest.time + ":00" - - db = mih_database.dbConnection.dbMzansiCalendarConnect() - cursor = db.cursor() - query = "update appointments " - query += "set date_time=%s, title=%s, description=%s " - query += "where idappointments=%s" - patientData = (date_time, - itemRequest.title, - itemRequest.description, - itemRequest.idappointments) - try: - cursor.execute(query, patientData) - except Exception as error: - print(error) - raise HTTPException(status_code=404, detail="Failed to Update Record") - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Updated Record"} - -# Update Patient on table -@router.delete("/appointment/delete/", tags=["Appointments"]) -async def Delete_appointment(itemRequest : appointmentDeleteRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbMzansiCalendarConnect() - cursor = db.cursor() - query = "delete from appointments " - query += "where idappointments=%s" - try: - cursor.execute(query, (str(itemRequest.idappointments),)) - except Exception as error: - print(error) - raise HTTPException(status_code=404, detail="Failed to Delete Appointment") - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully deleted Appointment"} - \ No newline at end of file diff --git a/mih_api_hub/routers/business.py b/mih_api_hub/routers/business.py deleted file mode 100644 index 560e8b81..00000000 --- a/mih_api_hub/routers/business.py +++ /dev/null @@ -1,385 +0,0 @@ -from fastapi import APIRouter, HTTPException, status -from pydantic import BaseModel -#from ..mih_database import dbConnection -import mih_database -import mih_database.mihDbConnections -from mih_database.mihDbObjects import User, Business, BusinessRating, BookmarkedBusiness -from sqlalchemy import desc, or_ -from sqlalchemy.orm import Session -from sqlalchemy.sql import func -#SuperToken Auth from front end -from supertokens_python.recipe.session.framework.fastapi import verify_session -from supertokens_python.recipe.session import SessionContainer -from fastapi import Depends -import uuid - -router = APIRouter() - -# class userRequest(BaseModel): -# email: str -# DocOfficeID: int - -class businessInsertRequest(BaseModel): - Name: str - type: str - registration_no: str - logo_name: str - logo_path: str - contact_no: str - bus_email: str - gps_location: str - practice_no: str - vat_no: str - website: str - rating: str - mission_vision: str - -class businessUpdateRequest(BaseModel): - business_id: str - Name: str - type: str - registration_no: str - logo_name: str - logo_path: str - contact_no: str - bus_email: str - gps_location: str - practice_no: str - vat_no: str - -class businessUpdateRequestV2(BaseModel): - business_id: str - Name: str - type: str - registration_no: str - logo_name: str - logo_path: str - contact_no: str - bus_email: str - gps_location: str - practice_no: str - vat_no: str - website: str - rating: str - mission_vision: str - -@router.get("/business/count/", tags=["MIH Business"]) -async def read_business_by_business_id(): #, session: SessionContainer = Depends(verify_session()) - dbEngine = mih_database.mihDbConnections.dbAllConnect() - dbSession = Session(dbEngine) - try: - queryResults = dbSession.query(func.count(Business.business_id)).scalar() - response_data = {"count": queryResults} - return response_data - except Exception as e: - print(f"An error occurred during the ORM query: {e}") - if dbSession.is_active: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail="Failed to retrieve records due to an internal server error." - ) - finally: - dbSession.close() - -# Get List of all files -@router.get("/business/types/", tags=["MIH Business"]) -async def read_business_by_business_id(session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - dbEngine = mih_database.mihDbConnections.dbAllConnect() - dbSession = Session(dbEngine) - try: - queryResults = dbSession.query(Business.type).distinct().order_by(Business.type).all() - response_data = [{"type": t[0]} for t in queryResults] - return response_data - except Exception as e: - print(f"An error occurred during the ORM query: {e}") - if dbSession.is_active: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail="Failed to retrieve records due to an internal server error." - ) - finally: - dbSession.close() - -# Get List of all files -@router.get("/business/search/{type}/{search}", tags=["MIH Business"]) -async def read_all_businesses(search: str, type: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - dbEngine = mih_database.mihDbConnections.dbAllConnect() - dbSession = Session(dbEngine) - try: - queryResults = dbSession.query(Business) - type_term_with_wildcards = "" - if type != "All": - type_term_with_wildcards = f"%{type.lower()}%" - queryResults = queryResults.filter( - Business.type.ilike(type_term_with_wildcards) - ) - search_term_with_wildcards = "" - if search != "All": - search_term_with_wildcards = f"%{search.lower()}%" - queryResults = queryResults.filter( - or_( - Business.Name.ilike(search_term_with_wildcards), - Business.bus_email.ilike(search_term_with_wildcards), - Business.mission_vision.ilike(search_term_with_wildcards), - ) - ) - queryResults = queryResults.all() - response_data = [] - for business in queryResults: - response_data.append({ - "business_id": business.business_id, - "Name": business.Name, - "type": business.type, - "registration_no": business.registration_no, - "logo_name": business.logo_name, - "logo_path": business.logo_path, - "contact_no": business.contact_no, - "bus_email": business.bus_email, - "app_id": "", - "gps_location": business.gps_location, - "practice_no": business.practice_no, - "vat_no": business.vat_no, - "website": business.website, - "rating": business.rating, - "mission_vision": business.mission_vision, - }) - - return response_data - except Exception as e: - print(f"An error occurred during the ORM query: {e}") - if dbSession.is_active: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail="Failed to retrieve records due to an internal server error." - ) - finally: - dbSession.close() - # db = mih_database.dbConnection.dbAppDataConnect() - # cursor = db.cursor() - # query = "SELECT business.business_id, business.Name, business.type, business.registration_no, " - # query += "business.logo_name, business.logo_path, business.contact_no, business.bus_email, " - # query += "business.gps_location, " - # query += "practice_no, vat_no, " - # query += "website, rating, mission_vision " - # query += "FROM business " - # query += "WHERE LOWER(business.Name) LIKE %s OR LOWER(business.type) LIKE %s " - # query += "OR LOWER(business.bus_email) LIKE %s OR LOWER(business.mission_vision) LIKE %s" - # search_term = f"%{search.lower()}%" # Add wildcards and lowercase - # cursor.execute(query, (search_term, search_term, search_term, search_term)) - # items = [ - # { - # "business_id": item[0], - # "Name": item[1], - # "type": item[2], - # "registration_no": item[3], - # "logo_name": item[4], - # "logo_path": item[5], - # "contact_no": item[6], - # "bus_email": item[7], - # "app_id": "", - # "gps_location": item[8], - # "practice_no": item[9], - # "vat_no": item[10], - # "website": item[11], - # "rating": item[12], - # "mission_vision": item[13], - # } - # for item in cursor.fetchall() - # ] - # cursor.close() - # db.close() - # return items - -# Get List of all files -@router.get("/business/business_id/{business_id}", tags=["MIH Business"]) -async def read_business_by_business_id(business_id: str): #, session: SessionContainer = Depends(verify_session()) - dbEngine = mih_database.mihDbConnections.dbAllConnect() - dbSession = Session(dbEngine) - try: - queryResults = dbSession.query(Business).\ - filter( - Business.business_id == business_id, - ).first() - if queryResults: - return { - "business_id": queryResults.business_id, - "Name": queryResults.Name, - "type": queryResults.type, - "registration_no": queryResults.registration_no, - "logo_name": queryResults.logo_name, - "logo_path": queryResults.logo_path, - "contact_no": queryResults.contact_no, - "bus_email": queryResults.bus_email, - "app_id": "", - "gps_location": queryResults.gps_location, - "practice_no": queryResults.practice_no, - "vat_no": queryResults.vat_no, - "website": queryResults.website, - "rating": queryResults.rating, - "mission_vision": queryResults.mission_vision, - } - else: - raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail="Business not found for the given business_id." - ) - except HTTPException as http_exc: - # Re-raise HTTPException directly if it was raised within the try block - raise http_exc - except Exception as e: - print(f"An error occurred during the ORM query: {e}") - if dbSession.is_active: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail="Failed to retrieve records due to an internal server error." - ) - finally: - dbSession.close() - -# Get List of all files -@router.get("/business/app_id/{app_id}", tags=["MIH Business"]) -async def read_business_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbAppDataConnect() - cursor = db.cursor() - query = "SELECT business.business_id, business.Name, business.type, business.registration_no, " - query += "business.logo_name, business.logo_path, business.contact_no, business.bus_email, " - query += "business_users.app_id, business.gps_location, " - query += "practice_no, vat_no, " - query += "website, rating, mission_vision " - query += "FROM business " - query += "inner join business_users " - query += "on business.business_id=business_users.business_id " - query += "where business_users.app_id = %s" - try: - cursor.execute(query, (app_id,)) - except Exception as error: - raise HTTPException(status_code=404, detail="Failed to pull records") - items = [ - { - "business_id": item[0], - "Name": item[1], - "type": item[2], - "registration_no": item[3], - "logo_name": item[4], - "logo_path": item[5], - "contact_no": item[6], - "bus_email": item[7], - "app_id": item[8], - "gps_location": item[9], - "practice_no": item[10], - "vat_no": item[11], - "website": item[12], - "rating": item[13], - "mission_vision": item[14], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - if(len(items)!= 0): - return items[0] - else: - raise HTTPException(status_code=404, detail="No record found") - -# Insert Patient into table -@router.post("/business/insert/", tags=["MIH Business"], status_code=201) -async def insert_business_details(itemRequest : businessInsertRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbAppDataConnect() - cursor = db.cursor() - query = "insert into business " - query += "(business_id, Name, type, registration_no, logo_name, logo_path, contact_no, bus_email, gps_location, practice_no, vat_no, website, rating, mission_vision) " - query += "values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" - uuidString = str(uuid.uuid1()) - userData = (uuidString, - itemRequest.Name, - itemRequest.type, - itemRequest.registration_no, - itemRequest.logo_name, - itemRequest.logo_path, - itemRequest.contact_no, - itemRequest.bus_email, - itemRequest.gps_location, - itemRequest.practice_no, - itemRequest.vat_no, - itemRequest.website, - itemRequest.rating, - itemRequest.mission_vision, - ) - try: - print(query) - print(userData) - cursor.execute(query, userData) - except Exception as error: - raise HTTPException(status_code=404, detail=error) - # return {"message": error} - db.commit() - cursor.close() - db.close() - return {"business_id": uuidString} - -@router.put("/business/update/", tags=["MIH Business"]) -async def Update_Business_details(itemRequest : businessUpdateRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbAppDataConnect() - # print(itemRequest.gps_location) - cursor = db.cursor() - query = "update business " - query += "set Name=%s, type=%s, registration_no=%s, logo_name=%s, logo_path=%s, contact_no=%s, bus_email=%s, gps_location=%s, practice_no=%s, vat_no=%s " - query += "where business_id=%s" - userData = (itemRequest.Name, - itemRequest.type, - itemRequest.registration_no, - itemRequest.logo_name.replace(" ", "-"), - itemRequest.logo_path.replace(" ", "-"), - itemRequest.contact_no, - itemRequest.bus_email, - itemRequest.gps_location, - itemRequest.practice_no, - itemRequest.vat_no, - itemRequest.business_id, - ) - try: - cursor.execute(query, userData) - except Exception as error: - raise HTTPException(status_code=404, detail=error) - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Updated Record"} - -@router.put("/business/update/v2/", tags=["MIH Business"]) -async def Update_Business_details(itemRequest : businessUpdateRequestV2, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbAppDataConnect() - # print(itemRequest.gps_location) - cursor = db.cursor() - query = "update business " - query += "set Name=%s, type=%s, registration_no=%s, logo_name=%s, logo_path=%s, contact_no=%s, bus_email=%s, gps_location=%s, practice_no=%s, vat_no=%s, website=%s, rating=%s, mission_vision=%s " - query += "where business_id=%s" - userData = (itemRequest.Name, - itemRequest.type, - itemRequest.registration_no, - itemRequest.logo_name.replace(" ", "-"), - itemRequest.logo_path.replace(" ", "-"), - itemRequest.contact_no, - itemRequest.bus_email, - itemRequest.gps_location, - itemRequest.practice_no, - itemRequest.vat_no, - itemRequest.website, - itemRequest.rating, - itemRequest.mission_vision, - itemRequest.business_id, - ) - try: - cursor.execute(query, userData) - except Exception as error: - raise HTTPException(status_code=404, detail=error) - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Updated Record"} \ No newline at end of file diff --git a/mih_api_hub/routers/business_user.py b/mih_api_hub/routers/business_user.py deleted file mode 100644 index d5e6d751..00000000 --- a/mih_api_hub/routers/business_user.py +++ /dev/null @@ -1,252 +0,0 @@ -from fastapi import APIRouter, HTTPException -from pydantic import BaseModel -#from ..mih_database import dbConnection -import mih_database -#SuperToken Auth from front end -from supertokens_python.recipe.session.framework.fastapi import verify_session -from supertokens_python.recipe.session import SessionContainer -from fastapi import Depends - -router = APIRouter() - -# class userRequest(BaseModel): -# email: str -# DocOfficeID: int - -class businessUserInsertRequest(BaseModel): - business_id: str - app_id: str - signature: str - sig_path: str - title: str - access: str - -class BusinessUserUpdateRequest(BaseModel): - business_id: str - app_id: str - signature: str - sig_path: str - title: str - access: str - -class EmployeeUpdateRequest(BaseModel): - business_id: str - app_id: str - title: str - access: str - -class employeeDeleteRequest(BaseModel): - business_id: str - app_id: str - -# Get List of all files -@router.get("/business-user/{app_id}", tags=["MIH Business_User"]) -async def read_business_users_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbAppDataConnect() - cursor = db.cursor() - query = "SELECT * FROM business_users where app_id = %s" - try: - cursor.execute(query, (app_id,)) - except Exception as error: - raise HTTPException(status_code=404, detail="Failed - " + error) - items = [ - { - "idbusiness_users": item[0], - "business_id": item[1], - "app_id": item[2], - "signature": item[3], - "sig_path": item[4], - "title": item[5], - "access": item[6], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - if(len(items)!= 0): - return items[0] - else: - raise HTTPException(status_code=404, detail="No record found") - -# Get List of all files -@router.get("/business-user/employees/{business_id}", tags=["MIH Business_User"]) -async def read_business_users_by_business_id(business_id: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbAppDataConnect() - cursor = db.cursor() - query = "" - query += "SELECT business_users.business_id, business_users.app_id, business_users.title, business_users.access, " - query += "users.fname, users.lname, users.email, users.username " - query += "FROM business_users " - query += "inner join users on business_users.app_id = users.app_id " - query += "where business_id = %s " - try: - cursor.execute(query, (business_id,)) - except Exception as error: - raise HTTPException(status_code=404, detail="Failed - " + error) - items = [ - { - "business_id": item[0], - "app_id": item[1], - "title": item[2], - "access": item[3], - "fname": item[4], - "lname": item[5], - "email": item[6], - "username": item[7], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - if(len(items)!= 0): - return items - else: - raise HTTPException(status_code=404, detail="No record found") - -# Insert Patient into table -@router.post("/business-user/insert/", tags=["MIH Business_User"], status_code=201) -async def insert_User_details(itemRequest : businessUserInsertRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbAppDataConnect() - cursor = db.cursor() - checkQuery = "SELECT * FROM business_users where app_id = %s" - try: - cursor.execute(checkQuery, (itemRequest.app_id,)) - except Exception as error: - raise HTTPException(status_code=404, detail="Failed - " + error) - items = [ - { - "idbusiness_users": item[0], - "business_id": item[1], - "app_id": item[2], - "signature": item[3], - "sig_path": item[4], - "title": item[5], - "access": item[6], - } - for item in cursor.fetchall() - ] - #print(f"checkQuery: {len(items)}") - if(len(items) <1): - createQuery = "insert into business_users " - createQuery += "(business_id, app_id, signature, sig_path, title, access) " - createQuery += "values (%s, %s, %s, %s, %s, %s)" - userData1 = (itemRequest.business_id, - itemRequest.app_id, - itemRequest.signature, - itemRequest.sig_path, - itemRequest.title, - itemRequest.access) - try: - cursor.execute(createQuery, userData1) - except Exception as error: - raise HTTPException(status_code=404, detail="Failed to Create Record") - #return {"message": "Failed to Create Record"} - else: - updateQuery = "update business_users " - updateQuery += "set business_id=%s, title=%s, access=%s " - updateQuery += "where app_id=%s" - userData2 = (itemRequest.business_id, - itemRequest.title, - itemRequest.access, - itemRequest.app_id, - ) - try: - cursor.execute(updateQuery, userData2) - except Exception as error: - raise HTTPException(status_code=404, detail=error) - - updateTypeQuery = "update users " - updateTypeQuery += "set type='business' " - updateTypeQuery += "where app_id=%s" - userData2 = ( - itemRequest.app_id, - ) - try: - cursor.execute(updateTypeQuery, userData2) - except Exception as error: - raise HTTPException(status_code=404, detail=error) - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Created Record"} - -# Update User on table -@router.put("/business-user/update/", tags=["MIH Business_User"]) -async def Update_User_details(itemRequest : BusinessUserUpdateRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbAppDataConnect() - cursor = db.cursor() - query = "update business_users " - query += "set signature=%s,sig_path=%s, title=%s, access=%s" - query += "where app_id=%s and business_id=%s" - userData = (itemRequest.signature, - itemRequest.sig_path, - itemRequest.title, - itemRequest.access, - itemRequest.app_id, - itemRequest.business_id, - ) - try: - cursor.execute(query, userData) - except Exception as error: - raise HTTPException(status_code=404, detail=error) - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Updated Record"} - -# Update User on table -@router.put("/business-user/employees/update/", tags=["MIH Business_User"]) -async def Update_User_details(itemRequest : EmployeeUpdateRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbAppDataConnect() - cursor = db.cursor() - query = "update business_users " - query += "set title=%s, access=%s" - query += "where app_id=%s and business_id=%s" - userData = ( - itemRequest.title, - itemRequest.access, - itemRequest.app_id, - itemRequest.business_id, - ) - try: - cursor.execute(query, userData) - except Exception as error: - raise HTTPException(status_code=404, detail=error) - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Updated Record"} - -# Delete Patient note on table -@router.delete("/business-user/employees/delete/", tags=["MIH Business_User"]) -async def Delete_Patient_note(itemRequest : employeeDeleteRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - # today = date.today() - db = mih_database.dbConnection.dbAppDataConnect() - cursor = db.cursor() - query = "delete from business_users " - query += "where business_id=%s " - query += "and app_id=%s" - # notetData = (itemRequest.idpatient_notes) - try: - cursor.execute(query, (itemRequest.business_id, - itemRequest.app_id,)) - except Exception as error: - #raise HTTPException(status_code=404, detail="Failed to Delete Record") - return {"query": query, "message": error} - - updateTypeQuery = "update users " - updateTypeQuery += "set type='personal' " - updateTypeQuery += "where app_id=%s" - userData2 = ( - itemRequest.app_id, - ) - try: - cursor.execute(updateTypeQuery, userData2) - except Exception as error: - raise HTTPException(status_code=404, detail=error) - db.commit() - cursor.close() - db.close() - return {"message": "Successfully deleted Record"} \ No newline at end of file diff --git a/mih_api_hub/routers/claim_statement_files.py b/mih_api_hub/routers/claim_statement_files.py deleted file mode 100644 index d7c187e4..00000000 --- a/mih_api_hub/routers/claim_statement_files.py +++ /dev/null @@ -1,112 +0,0 @@ -import mysql.connector -from fastapi import APIRouter, HTTPException -from pydantic import BaseModel -#from ..mih_database import dbConnection -import mih_database -from datetime import date -#SuperToken Auth from front end -from supertokens_python.recipe.session.framework.fastapi import verify_session -from supertokens_python.recipe.session import SessionContainer -from fastapi import Depends - -router = APIRouter() - -class claimStatementDeleteRequest(BaseModel): - idclaim_statement_file: int - -class claimStatementInsertRequest(BaseModel): - app_id: str - business_id: str - file_path: str - file_name: str - - -# Get List of all files by patient -@router.get("/files/claim-statement/patient/{app_id}", tags=["Claim Statement Files"]) -async def read_all_claim_statement_files_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())): - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "SELECT * FROM claim_statement_file where app_id = %s ORDER BY insert_date DESC" - cursor.execute(query, (app_id,)) - items = [ - { - "idclaim_statement_file": item[0], - "app_id": item[1], - "business_id": item[2], - "insert_date": item[3], - "file_path": item[4], - "file_name": item[5], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - -# Get List of all files by patient -@router.get("/files/claim-statement/business/{business_id}", tags=["Claim Statement Files"]) -async def read_all_claim_statement_files_by_business_id(business_id: str, session: SessionContainer = Depends(verify_session())): - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "SELECT * FROM claim_statement_file where business_id = %s ORDER BY insert_date DESC" - cursor.execute(query, (business_id,)) - items = [ - { - "idclaim_statement_file": item[0], - "app_id": item[1], - "business_id": item[2], - "insert_date": item[3], - "file_path": item[4], - "file_name": item[5], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - -# Delete Patient note on table -@router.delete("/files/claim-statement/delete/", tags=["Claim Statement Files"]) -async def Delete_Patient_File(itemRequest : claimStatementDeleteRequest, session: SessionContainer = Depends(verify_session())): #session: SessionContainer = Depends(verify_session()) - # today = date.today() - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "delete from claim_statement_file " - query += "where idclaim_statement_file=%s" - # notetData = (itemRequest.idpatient_notes) - try: - cursor.execute(query, (str(itemRequest.idclaim_statement_file),)) - except Exception as error: - raise HTTPException(status_code=404, detail="Failed to Delete Record") - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully deleted Record"} - -# Insert Patient note into table -@router.post("/files/claim-statement/insert/", tags=["Claim Statement Files"], status_code=201) -async def insert_Patient_Files(itemRequest : claimStatementInsertRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - today = date.today() - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "insert into claim_statement_file " - query += "(app_id, business_id, file_path, file_name, insert_date) " - query += "values (%s, %s, %s, %s, %s)" - notetData = ( - itemRequest.app_id, - itemRequest.business_id, - itemRequest.file_path, - itemRequest.file_name, - today, - ) - try: - cursor.execute(query, notetData) - except Exception as error: - print(error) - raise HTTPException(status_code=404, detail="Failed to Create Record") - # return {"message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Created file Record"} diff --git a/mih_api_hub/routers/docOffices.py b/mih_api_hub/routers/docOffices.py deleted file mode 100644 index acd484e8..00000000 --- a/mih_api_hub/routers/docOffices.py +++ /dev/null @@ -1,64 +0,0 @@ -import mysql.connector -from fastapi import APIRouter, HTTPException -#from ..mih_database import dbConnection -import mih_database -#SuperToken Auth from front end -from supertokens_python.recipe.session.framework.fastapi import verify_session -from supertokens_python.recipe.session import SessionContainer -from fastapi import Depends - -router = APIRouter() - -# Get Doctors Office By ID -@router.get("/docOffices/{docOffic_id}", tags=["Doctor Office"]) -async def read_docOffice_By_ID(docOffic_id: int, session: SessionContainer = Depends(verify_session())): - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "SELECT * FROM doctor_offices WHERE iddoctor_offices=%s" - cursor.execute(query, (docOffic_id,)) - item = cursor.fetchone() - cursor.close() - db.close() - if item is None: - raise HTTPException(status_code=404, detail="Item not found") - return {"iddoctor_offices": item[0], - "office_name": item[1]} - -# Get Doctors Office By user -@router.get("/docOffices/user/{user}", tags=["Doctor Office"]) -async def read_docOffice_By_ID(user: str, session: SessionContainer = Depends(verify_session())): - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "SELECT * FROM users WHERE email=%s" - cursor.execute(query, (user,)) - item = cursor.fetchone() - cursor.close() - db.close() - if item is None: - raise HTTPException(status_code=404, detail="Item not found") - return { - "idUser": item[0], - "UserName": item[1], - "docOffice_id": item[2], - "fname": item[3], - "lname": item[4], - "title": item[5], - } - -# Get List of all Doctors Office -@router.get("/docOffices/", tags=["Doctor Office"]) -async def read_All_Doctors_Office(session: SessionContainer = Depends(verify_session())): - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "SELECT * FROM doctor_offices" - cursor.execute(query) - items = [ - { - "iddoctor_offices": item[0], - "office_name": item[1] - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items diff --git a/mih_api_hub/routers/fileStorage.py b/mih_api_hub/routers/fileStorage.py deleted file mode 100644 index 60ddd6a7..00000000 --- a/mih_api_hub/routers/fileStorage.py +++ /dev/null @@ -1,574 +0,0 @@ -from textwrap import wrap -import io -from datetime import datetime, date -from typing import List -import requests - -from fastapi import APIRouter, HTTPException, File, UploadFile, Form -from fastapi.responses import FileResponse, JSONResponse - -from pydantic import BaseModel - -from minio import Minio -import Minio_Storage - -from reportlab.pdfgen import canvas -from reportlab.lib.pagesizes import A4 -from reportlab.lib.utils import ImageReader -from reportlab.platypus import SimpleDocTemplate - -from supertokens_python.recipe.session.framework.fastapi import verify_session -from supertokens_python.recipe.session import SessionContainer -from fastapi import Depends - -import Minio_Storage.minioConnection -from datetime import timedelta - - -router = APIRouter() - -class minioPullRequest(BaseModel): - file_path: str - -class minioDeleteRequest(BaseModel): - file_path: str - env: str - -class medCertUploud(BaseModel): - app_id: str - env: str - patient_full_name: str - fileName: str - id_no: str - docfname: str - busName: str - busAddr: str - busNo: str - busEmail: str - startDate: str - endDate: str - returnDate: str - logo_path: str - sig_path: str - -class perscription(BaseModel): - name: str - unit: str - form: str - fullForm: str - quantity: str - dosage: str - times: str - days: str - repeats: str - -class perscriptionList(BaseModel): - app_id: str - env: str - patient_full_name: str - fileName: str - id_no: str - docfname: str - busName: str - busAddr: str - busNo: str - busEmail: str - logo_path: str - sig_path: str - data: List[perscription] - -class claimStatementUploud(BaseModel): - document_type: str - patient_app_id: str - env: str - patient_full_name: str - fileName: str - patient_id_no: str - has_med_aid: str - med_aid_no: str - med_aid_code: str - med_aid_name: str - med_aid_scheme: str - busName: str - busAddr: str - busNo: str - busEmail: str - provider_name: str - practice_no: str - vat_no: str - service_date: str - service_desc: str - service_desc_option: str - procedure_name: str - # procedure_date: str - procedure_additional_info: str - icd10_code: str - amount: str - pre_auth_no: str - logo_path: str - sig_path: str - -@router.get("/minio/pull/file/{env}/{app_id}/{folder}/{file_name}", tags=["Minio"]) -async def pull_File_from_user(app_id: str, folder: str, file_name: str, env: str): #, session: SessionContainer = Depends(verify_session()) - path = app_id + "/" + folder + "/" + file_name - print(path) - try: - # print(f"env: {env}") - # uploudFile(app_id, file.filename, extension[1], content) - - client = Minio_Storage.minioConnection.minioConnect(env) - # buckets = client.list_buckets() - # print("Connected to MinIO successfully!") - # print("Available buckets:", [bucket.name for bucket in buckets]) - miniourl = client.presigned_get_object( - bucket_name="mih", - object_name=path, - expires=timedelta(minutes=60) - ) - print("Generated presigned URL:", miniourl) - # if(env == "Dev"): - # miniourl.replace("minio", "localhost") - # temp = minioResponse.data#.encode('utf-8').strip() - # print(temp) - # print("=======================================================================") - # temp = temp.decode('utf-8') - #print(miniourl) - except Exception as error: - raise HTTPException(status_code=404, detail=f"MinIO connection failed: {str(error)}") - # return {"message": error} - if(env == "Dev"): - return { - # 10.0.2.2 - "minioURL": f"http://10.0.2.2:9000/mih/{app_id}/{folder}/{file_name}",#"http://localhost:9000/mih/{app_id}/{folder}/{file_name}", - } - else: - return { - "minioURL": miniourl, - } - -@router.post("/minio/upload/file/", tags=["Minio"]) -async def upload_File_to_user(file: UploadFile = File(...), app_id: str= Form(...), env: str= Form(...), folder: str= Form(...), session: SessionContainer = Depends(verify_session())): - extension = file.filename.split(".") - content = file.file - try: - uploudFile(app_id, env, folder, file.filename.replace(" ", "-"), extension[1], content) - except Exception as error: - raise HTTPException(status_code=404, detail=str(error)) - return {"message": f"Successfully Uploaded {file.filename}"} - - # return { - # "app_id": app_id, - # "file name": file.filename, - # "extension": extension[0], - # "file contents": file.file.read(), - # } - -@router.delete("/minio/delete/file/", tags=["Minio"]) -async def delete_File_of_user(requestItem: minioDeleteRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - path = requestItem.file_path - try: - # uploudFile(app_id, file.filename, extension[1], content) - client = Minio_Storage.minioConnection.minioConnect(requestItem.env) - - minioError = client.remove_object( - bucket_name="mih", - object_name=path - ) - except Exception as error: - raise HTTPException(status_code=404, detail=minioError) - # return {"message": error} - return {"message": "Successfully deleted File"} - # return { - # "app_id": app_id, - # "file name": file.filename, - # "extension": extension[0], - # "file contents": file.file.read(), - # } - -# Get List of all files by patient -@router.post("/minio/generate/med-cert/", tags=["Minio"]) -async def upload_med_cert_to_user(requestItem: medCertUploud, session: SessionContainer = Depends(verify_session())): - uploudMedCert(requestItem) - return {"message": "Successfully Generated File"} - -@router.post("/minio/generate/perscription/", tags=["Minio"]) -async def upload_perscription_to_user(requestItem: perscriptionList, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - uploudPerscription(requestItem) - return {"message": "Successfully Generated File"} - -@router.post("/minio/generate/claim-statement/", tags=["Minio"]) -async def upload_perscription_to_user(requestItem: claimStatementUploud, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - uploudClaimStatement(requestItem) - return {"message": "Successfully Generated File"} - -def uploudFile(app_id, env, folder, fileName, extension, content): - client = Minio_Storage.minioConnection.minioConnect(env) - found = client.bucket_exists(bucket_name="mih") - if not found: - client.make_bucket(bucket_name="mih") - else: - print("Bucket already exists") - fname = app_id + "/" + folder + "/" + fileName - client.put_object( - bucket_name="mih", - object_name=fname, - data=content, - length=-1, - part_size=10*1024*1024, - content_type=f"application/{extension}") - -def uploudMedCert(requestItem: medCertUploud): - client = Minio_Storage.minioConnection.minioConnect(requestItem.env) - generateMedCertPDF(requestItem) - today = datetime.today().strftime('%Y-%m-%d') - found = client.bucket_exists(bucket_name="mih") - if not found: - client.make_bucket(bucket_name="mih") - else: - print("Bucket already exists") - fileName = f"{requestItem.app_id}/patient_files/{requestItem.fileName}" - client.fput_object("mih", fileName, "temp-med-cert.pdf") - -def generateMedCertPDF(requestItem: medCertUploud): - client = Minio_Storage.minioConnection.minioConnect(requestItem.env) - new_logo_path = requestItem.logo_path.replace(" ","-") - new_sig_path = requestItem.sig_path.replace(" ","-") - minioLogo = client.get_object("mih", new_logo_path).read() - imageLogo = ImageReader(io.BytesIO(minioLogo)) - minioSig = client.get_object("mih", new_sig_path).read() - imageSig = ImageReader(io.BytesIO(minioSig)) - w,h = A4 - today = datetime.today().strftime('%d-%m-%Y') - myCanvas = canvas.Canvas("temp-med-cert.pdf", pagesize=A4) - - #Business Logo - myCanvas.drawImage(imageLogo, 50, h - 125,100,100, mask='auto') - - #Business Details - myCanvas.setFont('Helvetica-Bold', 10) - myCanvas.drawRightString(w - 50,h - 40, f"Name: {requestItem.busName}") - myCanvas.drawRightString(w - 50,h - 55, f"Address: {requestItem.busAddr}") - myCanvas.drawRightString(w - 50,h - 70, f"Contact No.: {requestItem.busNo}") - myCanvas.drawRightString(w - 50,h - 85, f"Email: {requestItem.busEmail}") - myCanvas.line(50,h-150,w-50,h-150) - #Todays Date - myCanvas.setFont('Helvetica', 12) - issueDate = str(today) - myCanvas.drawRightString(w - 50,h - 180,issueDate) - - #Title - myCanvas.setFont('Helvetica-Bold', 20) - myCanvas.drawString(w-375, h - 200, "Medical Certificate") - - #Body - myCanvas.setFont('Helvetica', 12) - body = "" - body += "This is to certify that " + requestItem.patient_full_name.upper() + " (" + requestItem.id_no+ ") was seen by " + requestItem.docfname.upper() + " on " + requestItem.startDate + "." - body += "\nHe/She is unfit to attend work/school from " + requestItem.startDate + " up to and including " + requestItem.endDate + "." - body += "\nHe/She will return on " + requestItem.returnDate + "." - - y = 250 - for line in wrap(body, 90): - myCanvas.drawString(50, h-y, line) - y += 30 - # myCanvas.drawString(50, h-250,line1) - # myCanvas.drawString(50, h-280,line2) - # myCanvas.drawString(50, h-310,line3) - - #Signature - myCanvas.drawImage(imageSig, 50, h - 690,100,100) - myCanvas.line(50,h-700,200,h-700) - myCanvas.drawString(50, h-720, requestItem.docfname.upper()) - - #QR Verification - qrText = requestItem.patient_full_name.upper() + " booked off from " + requestItem.startDate + " to " + requestItem.endDate + " by " + requestItem.docfname.upper() + ".\nPowered by Mzansi Innovation Hub." - qrText = qrText.replace(" ","+") - - url = f"https://api.qrserver.com/v1/create-qr-code/?data={qrText}&size=100x100" - response = requests.get(url) - image = ImageReader(io.BytesIO(response.content)) - myCanvas.drawImage(image,w-150, h-700,100,100) - - myCanvas.setFont('Helvetica-Bold', 15) - myCanvas.drawString(w-150,h-720,"Scan to verify") - - myCanvas.save() - -def uploudPerscription(requestItem: perscriptionList): - client = Minio_Storage.minioConnection.minioConnect(requestItem.env) - generatePerscriptionPDF(requestItem) - today = datetime.today().strftime('%Y-%m-%d') - found = client.bucket_exists(bucket_name="mih") - if not found: - client.make_bucket(bucket_name="mih") - else: - print("Bucket already exists") - fileName = f"{requestItem.app_id}/patient_files/{requestItem.fileName}" - client.fput_object("mih", fileName, "temp-perscription.pdf") - -def generatePerscriptionPDF(requestItem: perscriptionList): - client = Minio_Storage.minioConnection.minioConnect(requestItem.env) - new_logo_path = requestItem.logo_path.replace(" ","-") - new_sig_path = requestItem.sig_path.replace(" ","-") - minioLogo = client.get_object("mih", new_logo_path).read() - imageLogo = ImageReader(io.BytesIO(minioLogo)) - minioSig = client.get_object("mih", new_sig_path).read() - imageSig = ImageReader(io.BytesIO(minioSig)) - w,h = A4 - - - myCanvas = canvas.Canvas("temp-perscription.pdf", pagesize=A4) - - #Business Logo - myCanvas.drawImage(imageLogo, 50, h - 125,100,100, mask='auto') - - #Business Details - myCanvas.setFont('Helvetica-Bold', 10) - myCanvas.drawRightString(w - 50,h - 40, f"Name: {requestItem.busName}") - myCanvas.drawRightString(w - 50,h - 55, f"Address: {requestItem.busAddr}") - myCanvas.drawRightString(w - 50,h - 70, f"Contact No.: {requestItem.busNo}") - myCanvas.drawRightString(w - 50,h - 85, f"Email: {requestItem.busEmail}") - myCanvas.line(50,h-150,w-50,h-150) - #Todays Date - myCanvas.setFont('Helvetica', 12) - today = datetime.today() - issueDate = today.strftime('%d-%m-%Y') - myCanvas.drawRightString(w - 50,h - 180,issueDate) - - #Title - myCanvas.setFont('Helvetica-Bold', 20) - myCanvas.drawString(w-375, h - 200, "Perscription") - - #Body - myCanvas.setFont('Helvetica-Bold', 12) - myCanvas.drawString(50, h-250, f"Patient: {requestItem.patient_full_name}") - myCanvas.drawString(50, h-270, f"Patient ID: {requestItem.id_no}") - - #boday headings - myCanvas.drawString(50, h-300, "Description") - myCanvas.drawRightString(w - 50, h-300, "Repeat(s)") - myCanvas.drawRightString(w - 150, h-300, "Quantity") - myCanvas.line(50,h-310,w-50,h-310) - - myCanvas.setStrokeColorRGB(0.749, 0.749, 0.749) - myCanvas.setFont('Helvetica', 12) - y = 330 - i = 0 - for persc in requestItem.data: - description1 = f"{persc.name} - {persc.form}" - description2 = f"{persc.dosage} {persc.fullForm}, {persc.times} time(s) daily, for {persc.days} day(s)" - quant = f"{persc.quantity}" - reps = f"{persc.repeats}" - - myCanvas.drawString(50, h-y, f"{i+1}.") - myCanvas.drawString(60, h-y, description1) - myCanvas.drawRightString(w-75, h-y, reps) - myCanvas.drawRightString(w-175, h-y, quant) - y+=15 - myCanvas.drawString(60, h-y, description2) - if(i 0: - return response_data - else: - # Return an empty response or a specific message - raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail="Business rating not found for the given business_id." - ) - except HTTPException as http_exc: - # Re-raise HTTPException directly if it was raised within the try block - raise http_exc - except Exception as e: - print(f"An error occurred during the ORM query: {e}") - if dbSession.is_active: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail="Failed to retrieve records due to an internal server error." - ) - finally: - dbSession.close() - -@router.post("/mzansi-directory/business-rating/insert/", tags=["Mzansi Directory"], status_code=201) -async def insert_loyalty_card(itemRequest : BusinessRatingInsertRequest): #, session: SessionContainer = Depends(verify_session()) - dbEngine = mih_database.mihDbConnections.dbAllConnect() - nowDateTime = datetime.now() - formatedDateTime = nowDateTime.strftime("%Y-%m-%d %H:%M:%S") - dbSession = Session(dbEngine) - try: - # Get No Of reviews for business - businessReviewCountQueryResults = dbSession.query(BusinessRating).\ - filter( - BusinessRating.business_id == itemRequest.business_id, - ).all() - businessReviewCount = len(businessReviewCountQueryResults) - print(f"Number of rows in business_ratings: {businessReviewCount}") - dbSession.flush() # Ensure the session is flushed before adding new records - # add business rating - new_rating = BusinessRating( - app_id=itemRequest.app_id, - business_id=itemRequest.business_id, - rating_title=itemRequest.rating_title, - rating_description=itemRequest.rating_description, - rating_score=itemRequest.rating_score, - date_time=formatedDateTime - ) - dbSession.add(new_rating) - dbSession.flush() # Ensure the new rating is added to the session - # Calc New Rating and update business rating - newRating = ((float(itemRequest.current_rating) * businessReviewCount) + float(itemRequest.rating_score)) / (businessReviewCount + 1) - businessToUpdate = dbSession.query(Business).filter(Business.business_id == itemRequest.business_id).first() - if businessToUpdate: - businessToUpdate.rating = str(newRating) - dbSession.commit() - else: - # Return an empty response or a specific message - raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail="Business not found for the given business_id." - ) - except HTTPException as http_exc: - # Re-raise HTTPException directly if it was raised within the try block - raise http_exc - except Exception as e: - print(f"An error occurred during the ORM query: {e}") - if dbSession.is_active: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail="Failed to insert records due to an internal server error." - ) - finally: - dbSession.close() - return {"message": "Successfully Created Record"} - -@router.delete("/mzansi-directory/business-rating/delete/", tags=["Mzansi Directory"]) -async def Delete_loyalty_card(itemRequest : BusinessRatingDeleteRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - dbEngine = mih_database.mihDbConnections.dbAllConnect() - dbSession = Session(dbEngine) - try: - # Get No Of reviews for business - businessReviewCountQueryResults = dbSession.query(BusinessRating).\ - filter( - BusinessRating.business_id == itemRequest.business_id, - ).all() - businessReviewCount = len(businessReviewCountQueryResults) - print(f"Number of rows in business_ratings: {businessReviewCount}") - dbSession.flush() # Ensure the session is flushed before adding new records - # delete business rating - rating_to_delete = dbSession.query(BusinessRating).\ - get( - itemRequest.idbusiness_ratings - ) - if not rating_to_delete: - raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail=f"Business rating with ID {itemRequest.idbusiness_ratings} not found." - ) - dbSession.delete(rating_to_delete) - dbSession.flush() # Ensure the new rating is added to the session - # Calc New Rating and update business rating - if(businessReviewCount <= 1): - newRating = "0.0" - else: - newRating = ((float(itemRequest.current_rating) * businessReviewCount) - float(itemRequest.rating_score)) / (businessReviewCount - 1) - businessToUpdate = dbSession.query(Business).filter(Business.business_id == itemRequest.business_id).first() - if businessToUpdate: - businessToUpdate.rating = str(newRating) - dbSession.commit() - else: - # Return an empty response or a specific message - raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail="Business not found for the given business_id." - ) - except HTTPException as http_exc: - # Re-raise HTTPException directly if it was raised within the try block - raise http_exc - except Exception as e: - print(f"An error occurred during the ORM query: {e}") - if dbSession.is_active: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail="Failed to insert records due to an internal server error." - ) - finally: - dbSession.close() - return {"message": "Successfully Deleted Record"} - -@router.put("/mzansi-directory/business-rating/update/", tags=["Mzansi Directory"]) -async def UpdatePatient(itemRequest : BusinessRatingUpdateRequest, session: SessionContainer = Depends(verify_session())): - dbEngine = mih_database.mihDbConnections.dbAllConnect() - nowDateTime = datetime.now() - formatedDateTime = nowDateTime.strftime("%Y-%m-%d %H:%M:%S") - dbSession = Session(dbEngine) - try: - # Get No Of reviews for business - businessReviewCountQueryResults = dbSession.query(BusinessRating).\ - filter( - BusinessRating.business_id == itemRequest.business_id, - ).all() - businessReviewCount = len(businessReviewCountQueryResults) - print(f"Number of rows in business_ratings: {businessReviewCount}") - dbSession.flush() # Ensure the session is flushed before adding new records - # Update business rating - rating_to_update = dbSession.query(BusinessRating).\ - get( - itemRequest.idbusiness_ratings - ) - if rating_to_update: - rating_to_update.rating_title = itemRequest.rating_title - rating_to_update.rating_description = itemRequest.rating_description - rating_to_update.rating_score = itemRequest.rating_new_score - rating_to_update.date_time = formatedDateTime - dbSession.flush() # Ensure the new rating is added to the session - else: - # Return an empty response or a specific message - raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail="Business not found for the given business_id." - ) - # Calc New Rating and update business rating - newRating = ((float(itemRequest.current_rating) * businessReviewCount) - float(itemRequest.rating_old_score) + float(itemRequest.rating_new_score)) / (businessReviewCount) - businessToUpdate = dbSession.query(Business).filter(Business.business_id == itemRequest.business_id).first() - if businessToUpdate: - businessToUpdate.rating = str(newRating) - dbSession.commit() - else: - # Return an empty response or a specific message - raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail="Business not found for the given business_id." - ) - except HTTPException as http_exc: - # Re-raise HTTPException directly if it was raised within the try block - raise http_exc - except Exception as e: - print(f"An error occurred during the ORM query: {e}") - if dbSession.is_active: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail="Failed to insert records due to an internal server error." - ) - finally: - dbSession.close() - return {"message": "Successfully wUpdated Record"} - -######################################################## -# Bookmarked Business # -######################################################## - -@router.get("/mzansi-directory/bookmarked-business/{app_id}/{business_id}", tags=["Mzansi Directory"]) -async def read_all_ratings_by_business_id(app_id: str,business_id: str, session: SessionContainer = Depends(verify_session())): # , session: SessionContainer = Depends(verify_session()) - dbEngine = mih_database.mihDbConnections.dbAllConnect() - dbSession = Session(dbEngine) - try: - queryResults = dbSession.query(BookmarkedBusiness, Business).\ - join(Business, BookmarkedBusiness.business_id == Business.business_id).\ - filter( - BookmarkedBusiness.business_id == business_id, - BookmarkedBusiness.app_id == app_id, - ).order_by( - desc(BookmarkedBusiness.created_date) - ).first() - if queryResults: - bookmark_obj, bus_obj = queryResults - return { - "idbookmarked_businesses": bookmark_obj.idbookmarked_businesses, - "app_id": bookmark_obj.app_id, - "business_id": bookmark_obj.business_id, - "business_name": bus_obj.Name, - "created_date": bookmark_obj.created_date, - } - else: - # Return an empty response or a specific message - raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail="Bookmarked Business rating not found for the given app_id & business_id." - ) - except HTTPException as http_exc: - # Re-raise HTTPException directly if it was raised within the try block - raise http_exc - except Exception as e: - print(f"An error occurred during the ORM query: {e}") - if dbSession.is_active: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail="Failed to retrieve records due to an internal server error." - ) - finally: - dbSession.close() - -@router.get("/mzansi-directory/bookmarked-business/user/all/{app_id}/", tags=["Mzansi Directory"]) -async def read_all_ratings_by_business_id(app_id: str, session: SessionContainer = Depends(verify_session())): # , session: SessionContainer = Depends(verify_session()) - dbEngine = mih_database.mihDbConnections.dbAllConnect() - dbSession = Session(dbEngine) - try: - queryResults = dbSession.query(BookmarkedBusiness, Business).\ - join(Business, BookmarkedBusiness.business_id == Business.business_id).\ - filter( - BookmarkedBusiness.app_id == app_id, - ).order_by( - desc(BookmarkedBusiness.created_date) - ).all() - response_data = [] - for rating_obj, bus_obj in queryResults: - response_data.append({ - "idbookmarked_businesses": rating_obj.idbookmarked_businesses, - "app_id": rating_obj.app_id, - "business_id": rating_obj.business_id, - "business_name": bus_obj.Name, - "created_date": rating_obj.created_date, - }) - if len(response_data) > 0: - return response_data - else: - # Return an empty response or a specific message - raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail="Bookmarked Business not found for the given app_id." - ) - except HTTPException as http_exc: - # Re-raise HTTPException directly if it was raised within the try block - raise http_exc - except Exception as e: - print(f"An error occurred during the ORM query: {e}") - if dbSession.is_active: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail="Failed to retrieve records due to an internal server error." - ) - finally: - dbSession.close() - -@router.post("/mzansi-directory/bookmarked-business/insert/", tags=["Mzansi Directory"], status_code=201) -async def insert_loyalty_card(itemRequest : BookmarkedBusinessInsertRequest): #, session: SessionContainer = Depends(verify_session()) - dbEngine = mih_database.mihDbConnections.dbAllConnect() - nowDateTime = datetime.now() - formatedDateTime = nowDateTime.strftime("%Y-%m-%d %H:%M:%S") - dbSession = Session(dbEngine) - try: - # add business rating - new_bookmarked_business = BookmarkedBusiness( - app_id=itemRequest.app_id, - business_id=itemRequest.business_id, - created_date=formatedDateTime - ) - dbSession.add(new_bookmarked_business) - dbSession.flush() # Ensure the new rating is added to the session - dbSession.commit() # Commit the session to save changes - except Exception as e: - print(f"An error occurred during the ORM query: {e}") - if dbSession.is_active: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail="Failed to insert records due to an internal server error." - ) - finally: - dbSession.close() - return {"message": "Successfully Created Record"} - -@router.delete("/mzansi-directory/bookmarked-business/delete/", tags=["Mzansi Directory"]) -async def Delete_loyalty_card(itemRequest : BookmarkedBusinessDeleteRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - dbEngine = mih_database.mihDbConnections.dbAllConnect() - dbSession = Session(dbEngine) - try: - # delete business rating - rating_to_delete = dbSession.query(BookmarkedBusiness).\ - get( - itemRequest.idbookmarked_businesses - ) - if not rating_to_delete: - raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail=f"Bookmarked Business with ID {itemRequest.idbusiness_ratings} not found." - ) - dbSession.delete(rating_to_delete) - dbSession.flush() # Ensure the new rating is added to the session - dbSession.commit() # Commit the session to save changes - except HTTPException as http_exc: - # Re-raise HTTPException directly if it was raised within the try block - raise http_exc - except Exception as e: - print(f"An error occurred during the ORM query: {e}") - if dbSession.is_active: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail="Failed to insert records due to an internal server error." - ) - finally: - dbSession.close() - return {"message": "Successfully Deleted Record"} diff --git a/mih_api_hub/routers/mzansi_wallet.py b/mih_api_hub/routers/mzansi_wallet.py deleted file mode 100644 index 88069b44..00000000 --- a/mih_api_hub/routers/mzansi_wallet.py +++ /dev/null @@ -1,177 +0,0 @@ -from fastapi import APIRouter, HTTPException -from pydantic import BaseModel -from datetime import date -#from ..mih_database import dbConnection -import mih_database -#SuperToken Auth from front end -from supertokens_python.recipe.session.framework.fastapi import verify_session -from supertokens_python.recipe.session import SessionContainer -from fastapi import Depends - -router = APIRouter() - -class LoyaltyCardDeleteRequest(BaseModel): - idloyalty_cards: int - -class MzansiWalletInsertRequest(BaseModel): - app_id: str - shop_name: str - card_number: str - favourite: str - priority_index: int - nickname: str - -class MzansiWalletUpdateRequest(BaseModel): - idloyalty_cards: int - favourite: str - priority_index: int - nickname: str - card_number: str -# class patientNoteUpdateRequest(BaseModel): -# idpatient_notes: int -# note_name: str -# note_text: str -# doc_office: str -# doctor: str -# patient_id: int - -# Get List of all loyalty cards by user -@router.get("/mzasni-wallet/loyalty-cards/{app_id}", tags=["Mzansi Wallet"]) -async def read_all_loyalty_cards_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())): # , session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbMzansiWalletConnect() - cursor = db.cursor() - query = "SELECT * FROM loyalty_cards where app_id = %s ORDER BY shop_name Asc" - cursor.execute(query, (app_id,)) - items = [ - { - "idloyalty_cards": item[0], - "app_id": item[1], - "shop_name": item[2], - "card_number": item[3], - "favourite": item[4], - "priority_index": item[5], - "nickname": item[6], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - -# Get List of favourite loyalty cards by user -@router.get("/mzasni-wallet/loyalty-cards/favourites/{app_id}", tags=["Mzansi Wallet"]) -async def read_favourite_loyalty_cards_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())): # , session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbMzansiWalletConnect() - cursor = db.cursor() - query = "SELECT * FROM loyalty_cards where app_id = %s and favourite != '' ORDER BY priority_index Asc" - cursor.execute(query, (app_id,)) - items = [ - { - "idloyalty_cards": item[0], - "app_id": item[1], - "shop_name": item[2], - "card_number": item[3], - "favourite": item[4], - "priority_index": item[5], - "nickname": item[6], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - -# Get List of all notes by patient -# @router.get("/notes/patients-docOffice/", tags="patients_notes") -# async def read_all_patientsby(itemRequest: noteRequest, session: SessionContainer = Depends(verify_session())): -# db = mih_database.dbConnection.dbPatientManagerConnect() -# cursor = db.cursor() -# query = "select patient_notes.idpatient_notes, patient_notes.note_name, patient_notes.note_text, patient_notes.patient_id, patient_notes.insert_date, patients.doc_office_id " -# query += "from patient_manager.patient_notes " -# query += "inner join patient_manager.patients " -# query += "on patient_notes.patient_id = patients.idpatients " -# query += "where patient_notes.patient_id = %s and patients.doc_office_id = %s" -# cursor.execute(query, (itemRequest.patientID, itemRequest.DocOfficeID,)) -# items = [ -# { -# "idpatient_notes": item[0], -# "note_name": item[1], -# "note_text": item[2], -# "insert_date": item[3], -# } -# for item in cursor.fetchall() -# ] -# cursor.close() -# db.close() -# return items - -# Insert loyalty cards into table -@router.post("/mzasni-wallet/loyalty-cards/insert/", tags=["Mzansi Wallet"], status_code=201) -async def insert_loyalty_card(itemRequest : MzansiWalletInsertRequest): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbMzansiWalletConnect() - cursor = db.cursor() - query = "insert into loyalty_cards " - query += "(app_id, shop_name, card_number, favourite, priority_index, nickname) " - query += "values (%s, %s, %s, %s, %s, %s)" - notetData = (itemRequest.app_id, - itemRequest.shop_name, - itemRequest.card_number, - itemRequest.favourite, - itemRequest.priority_index, - itemRequest.nickname, - ) - try: - cursor.execute(query, notetData) - except Exception as error: - print(error) - raise HTTPException(status_code=404, detail="Failed to Create Record") - # return {"message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Created Record"} - -# Delete loyalty cards on table -@router.delete("/mzasni-wallet/loyalty-cards/delete/", tags=["Mzansi Wallet"]) -async def Delete_loyalty_card(itemRequest : LoyaltyCardDeleteRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - # today = date.today() - db = mih_database.dbConnection.dbMzansiWalletConnect() - cursor = db.cursor() - query = "delete from loyalty_cards " - query += "where idloyalty_cards=%s" - # notetData = (itemRequest.idpatient_notes) - try: - cursor.execute(query, (str(itemRequest.idloyalty_cards),)) - except Exception as error: - print(error) - raise HTTPException(status_code=404, detail="Failed to Delete Record") - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully deleted Record"} - -# Update on table -@router.put("/mzasni-wallet/loyalty-cards/update/", tags=["Mzansi Wallet"]) -async def UpdatePatient(itemRequest : MzansiWalletUpdateRequest, session: SessionContainer = Depends(verify_session())): - today = date.today() - db = mih_database.dbConnection.dbMzansiWalletConnect() - cursor = db.cursor() - query = "update loyalty_cards " - query += "set favourite=%s, priority_index=%s, nickname=%s, card_number=%s " - query += "where idloyalty_cards=%s" - notetData = (itemRequest.favourite, - itemRequest.priority_index, - itemRequest.nickname, - itemRequest.card_number, - itemRequest.idloyalty_cards, - ) - try: - cursor.execute(query, notetData) - except Exception as error: - raise HTTPException(status_code=404, detail="Failed to Update Record") - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Updated Record"} \ No newline at end of file diff --git a/mih_api_hub/routers/notifications.py b/mih_api_hub/routers/notifications.py deleted file mode 100644 index 2091d3f9..00000000 --- a/mih_api_hub/routers/notifications.py +++ /dev/null @@ -1,141 +0,0 @@ -import mysql.connector -from fastapi import APIRouter, HTTPException -from pydantic import BaseModel -from datetime import datetime, timedelta -#from ..mih_database import dbConnection -import mih_database -#SuperToken Auth from front end -from supertokens_python.recipe.session.framework.fastapi import verify_session -from supertokens_python.recipe.session import SessionContainer -from fastapi import Depends - -router = APIRouter() - -class notificationsGetNuberedRequest(BaseModel): - notification_count: str - app_id: str - -class notificationInsertRequest(BaseModel): - app_id: str - notification_type: str - notification_message: str - action_path: str - -# class patientUpdateRequest(BaseModel): -# id_no: str -# app_id: str -# last_name: str -# email: str -# cell_no: str -# medical_aid: str -# medical_aid_main_member: str -# medical_aid_no: str -# medical_aid_code: str -# medical_aid_name: str -# medical_aid_scheme: str -# address: str -# app_id: str - -# class patientDeleteRequest(BaseModel): -# app_id: str - - -# Get Notifications By app ID -@router.get("/notifications/{app_id}", tags=["Notifications"]) -async def read_notifications_By_app_ID(app_id: str, amount: int, session: SessionContainer = Depends(verify_session())): # , session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbAppDataConnect() - cursor = db.cursor() - #query = "SELECT * FROM patients" - query = "Select * from notifications " - query += "where app_id = '%s' " % app_id - query += "order by insert_date desc " - query += "limit %s" % amount - # return {"query": query} - cursor.execute(query) - items = [ - { - "idnotifications": item[0], - "app_id": item[1], - "notification_message": item[2], - "notification_read": item[3], - "action_path": item[4], - "insert_date": item[5], - "notification_type": item[6], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - - -# Insert Patient into table -@router.post("/notifications/insert/", tags=["Notifications"], status_code=201) -async def insert_Patient(itemRequest : notificationInsertRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbAppDataConnect() - now = datetime.now() + timedelta(hours=2) - notificationDateTime = now.strftime("%Y-%m-%d %H:%M:%S") - print(notificationDateTime) - readType = "No" - cursor = db.cursor() - query = "insert into notifications " - query += "(app_id, notification_message, notification_read, action_path, insert_date, notification_type) " - query += "values (%s, %s, %s, %s, %s, %s)" - patientData = ( - itemRequest.app_id, - itemRequest.notification_message, - readType, - itemRequest.action_path, - notificationDateTime, - itemRequest.notification_type - ) - try: - cursor.execute(query, patientData) - except Exception as error: - print(error) - raise HTTPException(status_code=404, detail="Failed to Create Record") - # return {"message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Created Record"} - -# Update Patient on table -@router.put("/notifications/update/{notification_id}", tags=["Notifications"]) -async def Update_Patient(notification_id : str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbAppDataConnect() - cursor = db.cursor() - query = "update notifications " - query += "set notification_read=%s " - query += "where idnotifications=%s" - patientData = ("Yes", - notification_id, - ) - try: - cursor.execute(query, patientData) - except Exception as error: - raise HTTPException(status_code=404, detail="Failed to Update Record") - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Updated Record"} - -# # delete Patient on table -# @router.delete("/patients/delete/", tags=["Patients"]) -# async def Delete_Patient(itemRequest : patientDeleteRequest, session: SessionContainer = Depends(verify_session())): -# db = mih_database.dbConnection.dbPatientManagerConnect() -# cursor = db.cursor() -# query = "delete from patients " -# query += "where app_id=%s" -# patientData = (itemRequest.app_id, -# ) -# try: -# cursor.execute(query, patientData) -# except Exception as error: -# raise HTTPException(status_code=404, detail="Failed to delete Record") -# #return {"query": query, "message": error} -# db.commit() -# cursor.close() -# db.close() -# return {"message": "Successfully delete Record"} \ No newline at end of file diff --git a/mih_api_hub/routers/patient_access.py b/mih_api_hub/routers/patient_access.py deleted file mode 100644 index 263f7f19..00000000 --- a/mih_api_hub/routers/patient_access.py +++ /dev/null @@ -1,242 +0,0 @@ -import mysql.connector -from fastapi import APIRouter, HTTPException -from pydantic import BaseModel -#from ..mih_database import dbConnection -import mih_database -from datetime import date, datetime, timedelta -#SuperToken Auth from front end -from supertokens_python.recipe.session.framework.fastapi import verify_session -from supertokens_python.recipe.session import SessionContainer -from fastapi import Depends - -router = APIRouter() - -class accessRequestInsertRequest(BaseModel): - business_id: str - app_id: str - type: str - requested_by: str - -class accessRequestUpdateRequest(BaseModel): - business_id: str - app_id: str - status: str - approved_by: str - -class accessRequestReapplyRequest(BaseModel): - business_id: str - app_id: str - -@router.get("/access-requests/{access_type}/check/{business_id}", tags=["Patient Access"]) -async def check_business_id_has_access(access_type: str,business_id: str, app_id: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "select " - query += "patient_business_access.business_id, business.Name, " - query += "patient_business_access.app_id, users.fname, users.lname, " - query += "patients.id_no, " - query += "patient_business_access.type, patient_business_access.status, " - query += "patient_business_access.approved_by, patient_business_access.approved_on, " - query += "patient_business_access.requested_by, patient_business_access.requested_on " - query += "from data_access.patient_business_access " - query += "join app_data.business " - query += "on patient_business_access.business_id = business.business_id " - query += "join app_data.users " - query += "on patient_business_access.app_id = users.app_id " - query += "join patient_manager.patients " - query += "on patient_business_access.app_id = patients.app_id " - query += "where patient_business_access.type=%s and patient_business_access.business_id=%s and patient_business_access.app_id=%s" - cursor.execute(query, (access_type, - business_id, - app_id, - )) - items = [ - { - "business_id": item[0], - "business_name": item[1], - "app_id": item[2], - "fname": item[3], - "lname": item[4], - "id_no": item[5], - "type": item[6], - "status": item[7], - "approved_by": item[8], - "approved_on": item[9], - "requested_by": item[10], - "requested_on": item[11], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - -@router.get("/access-requests/business/{access_type}/{business_id}", tags=["Patient Access"]) -async def read_all_patient_access_by_business_id(access_type: str,business_id: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "select " - query += "patient_business_access.business_id, business.Name, " - query += "patient_business_access.app_id, users.fname, users.lname, " - query += "patients.id_no, " - query += "patient_business_access.type, patient_business_access.status, " - query += "patient_business_access.approved_by, patient_business_access.approved_on, " - query += "patient_business_access.requested_by, patient_business_access.requested_on " - query += "from data_access.patient_business_access " - query += "join app_data.business " - query += "on patient_business_access.business_id = business.business_id " - query += "join app_data.users " - query += "on patient_business_access.app_id = users.app_id " - query += "join patient_manager.patients " - query += "on patient_business_access.app_id = patients.app_id " - query += "where patient_business_access.type=%s and patient_business_access.business_id=%s" - cursor.execute(query, (access_type, - business_id,)) - items = [ - { - "business_id": item[0], - "business_name": item[1], - "app_id": item[2], - "fname": item[3], - "lname": item[4], - "id_no": item[5], - "type": item[6], - "status": item[7], - "approved_by": item[8], - "approved_on": item[9], - "requested_by": item[10], - "requested_on": item[11], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - -@router.get("/access-requests/personal/{access_type}/{app_id}", tags=["Patient Access"]) -async def read_all_patient_access_by_app_id(access_type: str,app_id: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "select " - query += "patient_business_access.business_id, business.Name, " - query += "patient_business_access.app_id, users.fname, users.lname, " - query += "patients.id_no, " - query += "patient_business_access.type, patient_business_access.status, " - query += "patient_business_access.approved_by, patient_business_access.approved_on, " - query += "patient_business_access.requested_by, patient_business_access.requested_on " - query += "from data_access.patient_business_access " - query += "join app_data.business " - query += "on patient_business_access.business_id = business.business_id " - query += "join app_data.users " - query += "on patient_business_access.app_id = users.app_id " - query += "join patient_manager.patients " - query += "on patient_business_access.app_id = patients.app_id " - query += "where patient_business_access.type=%s and patient_business_access.app_id=%s" - cursor.execute(query, (access_type, - app_id,)) - items = [ - { - "business_id": item[0], - "business_name": item[1], - "app_id": item[2], - "fname": item[3], - "lname": item[4], - "id_no": item[5], - "type": item[6], - "status": item[7], - "approved_by": item[8], - "approved_on": item[9], - "requested_by": item[10], - "requested_on": item[11], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - -# Insert Patient into table -@router.post("/access-requests/insert/", tags=["Patient Access"], status_code=201) -async def insert_Patient_access(itemRequest : accessRequestInsertRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbDataAccessConnect() - now = datetime.now() + timedelta(hours=2) - notificationDateTime = now.strftime("%Y-%m-%d %H:%M:%S") - print(notificationDateTime) - cursor = db.cursor() - query = "insert into patient_business_access " - query += "(business_id, app_id, type, status, approved_by, approved_on, requested_by, requested_on) " - query += "values (%s, %s, %s, %s, %s, %s, %s, %s)" - patientData = ( - itemRequest.business_id, - itemRequest.app_id, - itemRequest.type, - "pending", - "", - "9999-01-01 00:00:00", - itemRequest.requested_by, - now, - ) - try: - cursor.execute(query, patientData) - except Exception as error: - print(error) - raise HTTPException(status_code=404, detail="Failed to Create Record") - # return {"message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Created Record"} - -# Update Patient on table -@router.put("/access-requests/update/permission/", tags=["Patient Access"]) -async def Update_Patient_access(itemRequest: accessRequestUpdateRequest): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbDataAccessConnect() - now = datetime.now() + timedelta(hours=2) - notificationDateTime = now.strftime("%Y-%m-%d %H:%M:%S") - print(notificationDateTime) - cursor = db.cursor() - query = "update patient_business_access " - query += "set status=%s, approved_by=%s, approved_on=%s " - query += "where business_id=%s and app_id=%s" - patientData = (itemRequest.status, - itemRequest.approved_by, - now, - itemRequest.business_id, - itemRequest.app_id, - ) - try: - cursor.execute(query, patientData) - except Exception as error: - print(error) - raise HTTPException(status_code=404, detail="Failed to Update Record") - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Updated Record"} - -# Reapply Patient on table -@router.put("/access-requests/re-apply/", tags=["Patient Access"]) -async def Reapply_Patient_access(itemRequest: accessRequestReapplyRequest): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbDataAccessConnect() - now = datetime.now() + timedelta(hours=2) - notificationDateTime = now.strftime("%Y-%m-%d %H:%M:%S") - print(notificationDateTime) - cursor = db.cursor() - query = "update patient_business_access " - query += "set status='pending', approved_by='', approved_on='9999-01-01 00:00:00', requested_on=%s " - query += "where business_id=%s and app_id=%s" - patientData = (now, - itemRequest.business_id, - itemRequest.app_id, - ) - try: - cursor.execute(query, patientData) - except Exception as error: - print(error) - raise HTTPException(status_code=404, detail="Failed to Update Record") - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Updated Record"} \ No newline at end of file diff --git a/mih_api_hub/routers/patients.py b/mih_api_hub/routers/patients.py deleted file mode 100644 index 16991437..00000000 --- a/mih_api_hub/routers/patients.py +++ /dev/null @@ -1,298 +0,0 @@ -import mysql.connector -from fastapi import APIRouter, HTTPException -from pydantic import BaseModel -#from ..mih_database import dbConnection -import mih_database -#SuperToken Auth from front end -from supertokens_python.recipe.session.framework.fastapi import verify_session -from supertokens_python.recipe.session import SessionContainer -from fastapi import Depends - -router = APIRouter() - -class patientInsertRequest(BaseModel): - id_no: str - first_name: str - last_name: str - email: str - cell_no: str - medical_aid: str - medical_aid_main_member: str - medical_aid_no: str - medical_aid_code: str - medical_aid_name: str - medical_aid_scheme: str - address: str - app_id: str - -class patientUpdateRequest(BaseModel): - id_no: str - first_name: str - last_name: str - email: str - cell_no: str - medical_aid: str - medical_aid_main_member: str - medical_aid_no: str - medical_aid_code: str - medical_aid_name: str - medical_aid_scheme: str - address: str - app_id: str - -class patientDeleteRequest(BaseModel): - app_id: str - -# # Get Patient By ID Number -# @router.get("/patients/search/{search}", tags=["Patients"]) -# async def read_patientByID(search: str): #, session: SessionContainer = Depends(verify_session()) -# db = mih_database.dbConnection.dbPatientManagerConnect() -# cursor = db.cursor() -# query = "SELECT * FROM patients WHERE idpatients like %%%s%%" % search -# #return {"query": query} -# cursor.execute(query, (pat_id,)) -# item = cursor.fetchone() -# cursor.close() -# db.close() -# if item is None: -# raise HTTPException(status_code=404, detail="Item not found") -# return {"idpatients": item[0], -# "id_no": item[1], -# "first_name": item[2], -# "last_name": item[3], -# "email": item[4], -# "cell_no": item[5], -# "medical_aid_name": item[6], -# "medical_aid_no": item[7], -# "medical_aid_scheme": item[8], -# "address": item[9], -# "doc_office_id": item[10]} - - -# Get Patient By app ID -@router.get("/patients/{app_id}", tags=["Patients"]) -async def read_patient_By_app_ID(app_id: str, session: SessionContainer = Depends(verify_session())): - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "SELECT * FROM patients WHERE app_id=%s" - cursor.execute(query, (app_id,)) - item = cursor.fetchone() - cursor.close() - db.close() - if item is None: - raise HTTPException(status_code=404, detail="Item not found") - return {"idpatients": item[0], - "id_no": item[1], - "first_name": item[2], - "last_name": item[3], - "email": item[4], - "cell_no": item[5], - "medical_aid_name": item[6], - "medical_aid_no": item[7], - "medical_aid_scheme": item[8], - "address": item[9], - "medical_aid": item[10], - "medical_aid_main_member": item[11], - "medical_aid_code": item[12], - "app_id": item[13],} - -# # Get Patient By ID Number -# @router.get("/patients/email/{email}", tags="patients") -# async def read_patientByID(email: str, session: SessionContainer = Depends(verify_session())): -# db = mih_database.dbConnection.dbPatientManagerConnect() -# cursor = db.cursor() -# query = "SELECT * FROM patients WHERE lower(email)=%s" -# cursor.execute(query, (email.lower(),)) -# item = cursor.fetchone() -# cursor.close() -# db.close() -# if item is None: -# raise HTTPException(status_code=404, detail=("Item not found for "+ email)) -# return {"idpatients": item[0], -# "id_no": item[1], -# "first_name": item[2], -# "last_name": item[3], -# "email": item[4], -# "cell_no": item[5], -# "medical_aid_name": item[6], -# "medical_aid_no": item[7], -# "medical_aid_scheme": item[8], -# "address": item[9], -# "medical_aid": item[10], -# "medical_aid_main_member": item[11], -# "medical_aid_code": item[12],} - - -# Get List of all patients -@router.get("/patients/search/{search}", tags=["Patients"]) -async def read_all_patientsByUser(search: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - #query = "SELECT * FROM patients" - query = "Select * from patients " - query += "where id_no like '%%%s%%' " % search - query += "or medical_aid_no like '%%%s%%'" % search - # return {"query": query} - cursor.execute(query) - items = [ - { - "idpatients": item[0], - "id_no": item[1], - "first_name": item[2], - "last_name": item[3], - "email": item[4], - "cell_no": item[5], - "medical_aid": item[10], - "medical_aid_name": item[6], - "medical_aid_no": item[7], - "medical_aid_main_member": item[11], - "medical_aid_code": item[12], - "medical_aid_scheme": item[8], - "address": item[9], - "app_id": item[13], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - -# # Get List of all patients -# @router.get("/patients/", tags="patients") -# async def read_all_patients(session: SessionContainer = Depends(verify_session())): -# db = mih_database.dbConnection.dbPatientManagerConnect() -# cursor = db.cursor() -# query = "SELECT * FROM patients" -# cursor.execute(query) -# items = [ -# { -# "idpatients": item[0], -# "id_no": item[1], -# "first_name": item[2], -# "last_name": item[3], -# "email": item[4], -# "cell_no": item[5], -# "medical_aid_name": item[6], -# "medical_aid_no": item[7], -# "medical_aid_scheme": item[8], -# "address": item[9], -# "doc_office_id": item[10] -# } -# for item in cursor.fetchall() -# ] -# cursor.close() -# db.close() -# return items - -# # Get List of all patients by Doctors Office -# @router.get("/patients/docOffice/{docoff_id}", tags="patients") -# async def read_all_patientsby(docoff_id: str, session: SessionContainer = Depends(verify_session())): -# db = mih_database.dbConnection.dbPatientManagerConnect() -# cursor = db.cursor() -# query = "SELECT * FROM patients where doc_office_id=%s" -# cursor.execute(query, (docoff_id,)) -# items = [ -# { -# "idpatients": item[0], -# "id_no": item[1], -# "first_name": item[2], -# "last_name": item[3], -# "email": item[4], -# "cell_no": item[5], -# "medical_aid_name": item[6], -# "medical_aid_no": item[7], -# "medical_aid_scheme": item[8], -# "address": item[9], -# "doc_office_id": item[10] -# } -# for item in cursor.fetchall() -# ] -# cursor.close() -# db.close() -# return items - -# Insert Patient into table -@router.post("/patients/insert/", tags=["Patients"], status_code=201) -async def insert_Patient(itemRequest : patientInsertRequest, session: SessionContainer = Depends(verify_session())): - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "insert into patients " - query += "(id_no, first_name, last_name, email, cell_no, medical_aid, " - query += "medical_aid_main_member, medical_aid_no, medical_aid_code, medical_aid_name, " - query += "medical_aid_scheme, address, app_id) " - query += "values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" - patientData = (itemRequest.id_no, - itemRequest.first_name, - itemRequest.last_name, - itemRequest.email, - itemRequest.cell_no, - itemRequest.medical_aid, - itemRequest.medical_aid_main_member, - itemRequest.medical_aid_no, - itemRequest.medical_aid_code, - itemRequest.medical_aid_name, - itemRequest.medical_aid_scheme, - itemRequest.address, - itemRequest.app_id) - try: - cursor.execute(query, patientData) - except Exception as error: - raise HTTPException(status_code=404, detail="Failed to Create Record") - #return {"message": "Failed to Create Record"} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Created Record"} - -# Update Patient on table -@router.put("/patients/update/", tags=["Patients"]) -async def Update_Patient(itemRequest : patientUpdateRequest, session: SessionContainer = Depends(verify_session())): - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "update patients " - query += "set id_no=%s, first_name=%s, last_name=%s, email=%s, cell_no=%s, medical_aid=%s, " - query += "medical_aid_main_member=%s, medical_aid_no=%s, medical_aid_code=%s, medical_aid_name=%s, " - query += "medical_aid_scheme=%s, address=%s, app_id=%s " - query += "where app_id=%s" - patientData = (itemRequest.id_no, - itemRequest.first_name, - itemRequest.last_name, - itemRequest.email, - itemRequest.cell_no, - itemRequest.medical_aid, - itemRequest.medical_aid_main_member, - itemRequest.medical_aid_no, - itemRequest.medical_aid_code, - itemRequest.medical_aid_name, - itemRequest.medical_aid_scheme, - itemRequest.address, - itemRequest.app_id, - itemRequest.app_id,) - try: - cursor.execute(query, patientData) - except Exception as error: - raise HTTPException(status_code=404, detail="Failed to Update Record") - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Updated Record"} - -# delete Patient on table -@router.delete("/patients/delete/", tags=["Patients"]) -async def Delete_Patient(itemRequest : patientDeleteRequest, session: SessionContainer = Depends(verify_session())): - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "delete from patients " - query += "where app_id=%s" - patientData = (itemRequest.app_id, - ) - try: - cursor.execute(query, patientData) - except Exception as error: - raise HTTPException(status_code=404, detail="Failed to delete Record") - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully delete Record"} \ No newline at end of file diff --git a/mih_api_hub/routers/patients_files.py b/mih_api_hub/routers/patients_files.py deleted file mode 100644 index 538020f6..00000000 --- a/mih_api_hub/routers/patients_files.py +++ /dev/null @@ -1,132 +0,0 @@ -import mysql.connector -from fastapi import APIRouter, HTTPException -from pydantic import BaseModel -#from ..mih_database import dbConnection -import mih_database -from datetime import date -#SuperToken Auth from front end -from supertokens_python.recipe.session.framework.fastapi import verify_session -from supertokens_python.recipe.session import SessionContainer -from fastapi import Depends - -router = APIRouter() - -class fileDeleteRequest(BaseModel): - idpatient_files: int - -class fileInsertRequest(BaseModel): - file_path: str - file_name: str - app_id: str - -# # Get List of all files -# @router.get("/files/patients/", tags="patients_files") -# async def read_all_files(session: SessionContainer = Depends(verify_session())): -# db = mih_database.dbConnection.dbPatientManagerConnect() -# cursor = db.cursor() -# query = "SELECT * FROM patient_files" -# cursor.execute(query) -# items = [ -# { -# "idpatient_files": item[0], -# "file_path": item[1], -# "file_name": item[2], -# "patient_id": item[3], -# "insert_date": item[4], -# } -# for item in cursor.fetchall() -# ] -# cursor.close() -# db.close() -# return items - -# Get List of all files by patient -@router.get("/patient_files/get/{app_id}", tags=["Patients Files"]) -async def read_all_patient_files_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())): - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "SELECT * FROM patient_files where app_id = %s ORDER BY insert_date DESC" - cursor.execute(query, (app_id,)) - items = [ - { - "idpatient_files": item[0], - "file_path": item[1], - "file_name": item[2], - "insert_date": item[3], - "app_id": item[4], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - -# # Get List of all files by patient & DocOffice -# @router.get("/files/patients-docOffice/", tags="patients_files") -# async def read_all_files_by_patient(itemRequest: fileRequest, session: SessionContainer = Depends(verify_session())): -# db = mih_database.dbConnection.dbPatientManagerConnect() -# cursor = db.cursor() -# query = "select patient_files.idpatient_files, patient_files.file_path, patient_files.file_name, patient_files.patient_id, patient_files.insert_date, patients.doc_office_id " -# query += "from patient_manager.patient_files " -# query += "inner join patient_manager.patients " -# query += "on patient_files.patient_id = patients.idpatients " -# query += "where patient_files.patient_id = %s and patients.doc_office_id = %s" -# cursor.execute(query, (itemRequest.patientID, itemRequest.DocOfficeID,)) - -# items = [ -# { -# "idpatient_files": item[0], -# "file_path": item[1], -# "file_name": item[2], -# "patient_id": item[3], -# "insert_date": item[4], -# "doc_office_id": item[5] -# } -# for item in cursor.fetchall() -# ] -# cursor.close() -# db.close() -# return items - -# Delete Patient note on table -@router.delete("/patient_files/delete/", tags=["Patients Files"]) -async def Delete_Patient_File(itemRequest : fileDeleteRequest, session: SessionContainer = Depends(verify_session())): #session: SessionContainer = Depends(verify_session()) - # today = date.today() - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "delete from patient_files " - query += "where idpatient_files=%s" - # notetData = (itemRequest.idpatient_notes) - try: - cursor.execute(query, (str(itemRequest.idpatient_files),)) - except Exception as error: - raise HTTPException(status_code=404, detail="Failed to Delete Record") - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully deleted Record"} - -# Insert Patient note into table -@router.post("/patient_files/insert/", tags=["Patients Files"], status_code=201) -async def insert_Patient_Files(itemRequest : fileInsertRequest, session: SessionContainer = Depends(verify_session())): - today = date.today() - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "insert into patient_files " - query += "(file_path, file_name, insert_date, app_id) " - query += "values (%s, %s, %s, %s)" - notetData = (itemRequest.file_path, - itemRequest.file_name, - today, - itemRequest.app_id, - ) - try: - cursor.execute(query, notetData) - except Exception as error: - #raise HTTPException(status_code=404, detail="Failed to Create Record") - return {"message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Created file Record"} diff --git a/mih_api_hub/routers/patients_notes.py b/mih_api_hub/routers/patients_notes.py deleted file mode 100644 index 31b02b15..00000000 --- a/mih_api_hub/routers/patients_notes.py +++ /dev/null @@ -1,166 +0,0 @@ -import mysql.connector -from fastapi import APIRouter, HTTPException -from pydantic import BaseModel -from datetime import date -#from ..mih_database import dbConnection -import mih_database -#SuperToken Auth from front end -from supertokens_python.recipe.session.framework.fastapi import verify_session -from supertokens_python.recipe.session import SessionContainer -from fastapi import Depends - -router = APIRouter() - -class noteDeleteRequest(BaseModel): - idpatient_notes: int - -class patientNoteInsertRequest(BaseModel): - note_name: str - note_text: str - doc_office: str - doctor: str - app_id: str - -class patientNoteUpdateRequest(BaseModel): - idpatient_notes: int - note_name: str - note_text: str - doc_office: str - doctor: str - patient_id: int - -# Get List of all notes -# @router.get("/notes/patients/", tags="patients_notes") -# async def read_all_notes(session: SessionContainer = Depends(verify_session())): -# db = mih_database.dbConnection.dbPatientManagerConnect() -# cursor = db.cursor() -# query = "SELECT * FROM patient_notes" -# cursor.execute(query) -# items = [ -# { -# "idpatient_notes": item[0], -# "note_name": item[1], -# "note_text": item[2], -# "insert_date": item[3], -# } -# for item in cursor.fetchall() -# ] -# cursor.close() -# db.close() -# return items - -# Get List of all notes by patient -@router.get("/notes/patients/{app_id}", tags=["Patients Notes"]) -async def read_all_patient_notes_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())): - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "SELECT * FROM patient_notes where app_id = %s ORDER BY insert_date DESC" - cursor.execute(query, (app_id,)) - items = [ - { - "idpatient_notes": item[0], - "note_name": item[1], - "note_text": item[2], - "insert_date": item[3], - "doc_office": item[5], - "doctor": item[6], - "app_id": item[4] - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - -# Get List of all notes by patient -# @router.get("/notes/patients-docOffice/", tags="patients_notes") -# async def read_all_patientsby(itemRequest: noteRequest, session: SessionContainer = Depends(verify_session())): -# db = mih_database.dbConnection.dbPatientManagerConnect() -# cursor = db.cursor() -# query = "select patient_notes.idpatient_notes, patient_notes.note_name, patient_notes.note_text, patient_notes.patient_id, patient_notes.insert_date, patients.doc_office_id " -# query += "from patient_manager.patient_notes " -# query += "inner join patient_manager.patients " -# query += "on patient_notes.patient_id = patients.idpatients " -# query += "where patient_notes.patient_id = %s and patients.doc_office_id = %s" -# cursor.execute(query, (itemRequest.patientID, itemRequest.DocOfficeID,)) -# items = [ -# { -# "idpatient_notes": item[0], -# "note_name": item[1], -# "note_text": item[2], -# "insert_date": item[3], -# } -# for item in cursor.fetchall() -# ] -# cursor.close() -# db.close() -# return items - -# Insert Patient note into table -@router.post("/notes/insert/", tags=["Patients Notes"], status_code=201) -async def insert_Patient_Note(itemRequest : patientNoteInsertRequest, session: SessionContainer = Depends(verify_session())): - today = date.today() - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "insert into patient_notes " - query += "(note_name, note_text, insert_date, doc_office, doctor, app_id) " - query += "values (%s, %s, %s, %s, %s, %s)" - notetData = (itemRequest.note_name, - itemRequest.note_text, - today, - itemRequest.doc_office, - itemRequest.doctor, - itemRequest.app_id, - ) - try: - cursor.execute(query, notetData) - except Exception as error: - #raise HTTPException(status_code=404, detail="Failed to Create Record") - return {"message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Created Record"} - -# Delete Patient note on table -@router.delete("/notes/delete/", tags=["Patients Notes"]) -async def Delete_Patient_note(itemRequest : noteDeleteRequest, session: SessionContainer = Depends(verify_session()) ): #session: SessionContainer = Depends(verify_session()) - # today = date.today() - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "delete from patient_notes " - query += "where idpatient_notes=%s" - # notetData = (itemRequest.idpatient_notes) - try: - cursor.execute(query, (str(itemRequest.idpatient_notes),)) - except Exception as error: - raise HTTPException(status_code=404, detail="Failed to Delete Record") - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully deleted Record"} - -# Update Patient note on table -# @router.put("/notes/update/", tags="patients_notes") -# async def UpdatePatient(itemRequest : patientNoteUpdateRequest, session: SessionContainer = Depends(verify_session())): -# today = date.today() -# db = mih_database.dbConnection.dbPatientManagerConnect() -# cursor = db.cursor() -# query = "update patient_notes " -# query += "set note_name=%s, note_text=%s, patient_id=%s, insert_date=%s " -# query += "where idpatient_notes=%s" -# notetData = (itemRequest.note_name, -# itemRequest.note_text, -# itemRequest.patient_id, -# today, -# itemRequest.idpatient_notes) -# try: -# cursor.execute(query, notetData) -# except Exception as error: -# raise HTTPException(status_code=404, detail="Failed to Update Record") -# #return {"query": query, "message": error} -# db.commit() -# cursor.close() -# db.close() -# return {"message": "Successfully Updated Record"} \ No newline at end of file diff --git a/mih_api_hub/routers/patients_queue.py b/mih_api_hub/routers/patients_queue.py deleted file mode 100644 index 3b24dd63..00000000 --- a/mih_api_hub/routers/patients_queue.py +++ /dev/null @@ -1,172 +0,0 @@ -import mysql.connector -from fastapi import APIRouter, HTTPException -from pydantic import BaseModel -#from ..mih_database import dbConnection -import mih_database -from datetime import datetime, timedelta, date -#SuperToken Auth from front end -from supertokens_python.recipe.session.framework.fastapi import verify_session -from supertokens_python.recipe.session import SessionContainer -from fastapi import Depends - -router = APIRouter() - -class fileDeleteRequest(BaseModel): - idpatient_files: int - -class queueInsertRequest(BaseModel): - business_id: str - app_id: str - date: str - time: str - -class queueUpdateRequest(BaseModel): - idpatient_queue: int - date: str - time: str - -class queueDeleteRequest(BaseModel): - idpatient_queue: int - -# Get List of all files by patient -@router.get("/queue/appointments/business/{business_id}", tags=["Patients Queue"]) -async def read_all_patient_queue_by_business_id(business_id: str, date: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbPatientManagerConnect() - requestDate = datetime.strptime(date, '%Y-%m-%d').date() - #print("request date: " + str(requestDate)) - cursor = db.cursor() - # query = "SELECT patient_queue.idpatient_queue, patient_queue.business_id, " - # query += "patient_queue.app_id, patient_queue.date_time, " - # query += "patients.id_no, patients.first_name, patients.last_name, patients.medical_aid_no " - # query += "from patient_manager.patient_queue " - # query += "inner join patient_manager.patients " - # query += "on patient_queue.app_id = patients.app_id " - query = "SELECT patient_queue.idpatient_queue, patient_queue.business_id, " - query += "patient_queue.app_id, patient_queue.date_time, " - query += "patients.id_no, patients.first_name, patients.last_name, patients.medical_aid_no, business.Name " - query += "from patient_manager.patient_queue " - query += "join patient_manager.patients " - query += "on patient_queue.app_id = patients.app_id " - query += "join app_data.business " - query += "on patient_queue.business_id = business.business_id " - query = query + "where patient_queue.business_id = %s and date_time like '" + str(requestDate) + "%' " - query += "ORDER BY date_time ASC" - cursor.execute(query, (business_id,)) - items = [ - { - "idpatient_queue": item[0], - "business_id": item[1], - "app_id": item[2], - "date_time": item[3], - "id_no": item[4], - "first_name": item[5], - "last_name": item[6], - "medical_aid_no": item[7], - "business_name": item[8], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - -# Get List of all files by patient -@router.get("/queue/appointments/personal/{app_id}", tags=["Patients Queue"]) -async def read_all_patient_queue_by_business_id(app_id: str, date: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbPatientManagerConnect() - requestDate = datetime.strptime(date, '%Y-%m-%d').date() - cursor = db.cursor() - query = "SELECT patient_queue.idpatient_queue, patient_queue.business_id, " - query += "patient_queue.app_id, patient_queue.date_time, " - query += "patients.id_no, patients.first_name, patients.last_name, patients.medical_aid_no, business.Name " - query += "from patient_manager.patient_queue " - query += "join patient_manager.patients " - query += "on patient_queue.app_id = patients.app_id " - query += "join app_data.business " - query += "on patient_queue.business_id = business.business_id " - query = query + "where patient_queue.app_id = %s and date_time like '" + str(requestDate) + "%' " - query += "ORDER BY date_time ASC" - cursor.execute(query, (app_id,)) - items = [ - { - "idpatient_queue": item[0], - "business_id": item[1], - "app_id": item[2], - "date_time": item[3], - "id_no": item[4], - "first_name": item[5], - "last_name": item[6], - "medical_aid_no": item[7], - "business_name": item[8], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - -# Insert Patient note into table -@router.post("/queue/appointment/insert/", tags=["Patients Queue"], status_code=201) -async def insert_Patient_Files(itemRequest : queueInsertRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - date_time = itemRequest.date + " " + itemRequest.time + ":00" - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "insert into patient_queue " - query += "(business_id, app_id, date_time) " - query += "values (%s, %s, %s)" - notetData = (itemRequest.business_id, - itemRequest.app_id, - date_time, - ) - try: - cursor.execute(query, notetData) - except Exception as error: - #raise HTTPException(status_code=404, detail="Failed to Create Record") - return {"message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Created file Record"} - -# Update Patient on table -@router.put("/queue/appointment/update/", tags=["Patients Queue"]) -async def Update_Queue(itemRequest : queueUpdateRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - - date_time = itemRequest.date + " " + itemRequest.time + ":00" - - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "update patient_queue " - query += "set date_time=%s " - query += "where idpatient_queue=%s" - patientData = (date_time, - itemRequest.idpatient_queue) - try: - cursor.execute(query, patientData) - except Exception as error: - print(error) - raise HTTPException(status_code=404, detail="Failed to Update Record") - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Updated Record"} - -# Update Patient on table -@router.delete("/queue/appointment/delete/", tags=["Patients Queue"]) -async def Delete_Queue(itemRequest : queueDeleteRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbPatientManagerConnect() - cursor = db.cursor() - query = "delete from patient_queue " - query += "where idpatient_queue=%s" - try: - cursor.execute(query, (str(itemRequest.idpatient_queue),)) - except Exception as error: - print(error) - raise HTTPException(status_code=404, detail="Failed to Delete Appointment") - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully deleted Appointment"} - \ No newline at end of file diff --git a/mih_api_hub/routers/user_consent.py b/mih_api_hub/routers/user_consent.py deleted file mode 100644 index 747961d9..00000000 --- a/mih_api_hub/routers/user_consent.py +++ /dev/null @@ -1,138 +0,0 @@ -from fastapi import APIRouter, HTTPException, status -from pydantic import BaseModel -#from ..mih_database import dbConnection -import mih_database -import mih_database.mihDbConnections -from mih_database.mihDbObjects import UserConsent -from sqlalchemy import desc, or_ -from sqlalchemy.orm import Session -from sqlalchemy.sql import func -from sqlalchemy.exc import IntegrityError, SQLAlchemyError -#SuperToken Auth from front end -from supertokens_python.recipe.session.framework.fastapi import verify_session -from supertokens_python.recipe.session import SessionContainer -from fastapi import Depends -from datetime import datetime -import uuid - -router = APIRouter() - -class userConsentInsertRequest(BaseModel): - app_id: str - privacy_policy_accepted: datetime - terms_of_services_accepted: datetime - -class userConsentUpdateRequest(BaseModel): - app_id: str - privacy_policy_accepted: datetime - terms_of_services_accepted: datetime - -@router.get("/user-consent/user/{app_id}", tags=["User Consent"]) -async def get_user_consent(app_id: str, session: SessionContainer = Depends(verify_session())): - dbEngine = mih_database.mihDbConnections.dbAllConnect() - dbSession = Session(dbEngine) - try: - queryResults = dbSession.query(UserConsent).\ - filter(UserConsent.app_id == app_id).\ - first() - if queryResults: - return { - "idUserConsent": queryResults.iduser_consent, - "app_id": queryResults.app_id, - "privacy_policy_accepted": queryResults.privacy_policy_accepted, - "terms_of_services_accepted": queryResults.terms_of_services_accepted - } - else: - raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="User Consent not found") - except HTTPException as http_exc: - # Re-raise HTTPException directly if it was raised within the try block - raise http_exc - except Exception as e: - print(f"An error occurred during the ORM query: {e}") - if dbSession.is_active: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail="Failed to retrieve records due to an internal server error." - ) - finally: - dbSession.close() - -@router.post("/user-consent/insert/", - tags=["User Consent"], - status_code=status.HTTP_201_CREATED) -async def insert_user_consent(itemRequest: userConsentInsertRequest, - session: SessionContainer = Depends(verify_session())): - dbEngine = mih_database.mihDbConnections.dbAllConnect() - dbSession = Session(dbEngine) - try: - newUserConsent = UserConsent( - app_id = itemRequest.app_id, - privacy_policy_accepted = itemRequest.privacy_policy_accepted, - terms_of_services_accepted = itemRequest.terms_of_services_accepted, - ) - dbSession.add(newUserConsent) - dbSession.commit() - dbSession.refresh(newUserConsent) - return {"message": "Successfully Created file Record"} - except IntegrityError as e: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_409_CONFLICT, # 409 Conflict is often suitable for constraint errors - detail=f"Data integrity error: The provided data violates a database constraint. Details: {e.orig}" - ) from e - except SQLAlchemyError as e: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail=f"A database error occurred during insertion. Details: {e.orig}" - ) from e - except Exception as e: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail=f"An unexpected error occurred: {e}" - ) from e - finally: - dbSession.close() - -@router.put("/user-consent/update/", tags=["User Consent"]) -async def update_user_consent(itemRequest: userConsentUpdateRequest, - session: SessionContainer = Depends(verify_session())): - dbEngine = mih_database.mihDbConnections.dbAllConnect() - dbSession = Session(dbEngine) - # pp_accepted_dt = datetime.strptime(itemRequest.privacy_policy_accepted, "%Y-%m-%d %H:%M:%S") - # tos_accepted_dt = datetime.strptime(itemRequest.terms_of_services_accepted, "%Y-%m-%d %H:%M:%S") - try: - existing_consent = dbSession.query(UserConsent).filter(UserConsent.app_id == itemRequest.app_id).first() - if not existing_consent: - raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="User Consent not found") - - existing_consent.privacy_policy_accepted = itemRequest.privacy_policy_accepted - existing_consent.terms_of_services_accepted = itemRequest.terms_of_services_accepted - - dbSession.commit() - return {"message": "Successfully Updated User Consent Record"} - except HTTPException as http_exc: - # Re-raise HTTPException directly if it was raised within the try block - raise http_exc - except IntegrityError as e: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_409_CONFLICT, - detail=f"Data integrity error: The provided data violates a database constraint. Details: {e.orig}" - ) from e - except SQLAlchemyError as e: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail=f"A database error occurred during update. Details: {e.orig}" - ) from e - except Exception as e: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail=f"An unexpected error occurred: {e}" - ) from e - finally: - dbSession.close() \ No newline at end of file diff --git a/mih_api_hub/routers/users.py b/mih_api_hub/routers/users.py deleted file mode 100644 index a065e41b..00000000 --- a/mih_api_hub/routers/users.py +++ /dev/null @@ -1,280 +0,0 @@ -from fastapi import APIRouter, HTTPException, status -from pydantic import BaseModel -#from ..mih_database import dbConnection -import mih_database -import mih_database.mihDbConnections -from mih_database.mihDbObjects import User, Business, BusinessRating, BookmarkedBusiness -from sqlalchemy import desc, or_ -from sqlalchemy.orm import Session -from sqlalchemy.sql import func -#SuperToken Auth from front end -from supertokens_python.recipe.session.framework.fastapi import verify_session -from supertokens_python.recipe.session import SessionContainer -from supertokens_python.asyncio import delete_user - -from fastapi import Depends - -import mih_database.dbConnection -import Minio_Storage.minioConnection - -router = APIRouter() - -class userRequest(BaseModel): - email: str - DocOfficeID: int - -class userInsertRequest(BaseModel): - email: str - app_id: str - -class userUpdateRequestV2(BaseModel): - idusers: int - username: str - fnam: str - lname: str - type: str - pro_pic_path: str - purpose: str - -class userUpdateRequest(BaseModel): - idusers: int - username: str - fnam: str - lname: str - type: str - pro_pic_path: str - -class userDeleteRequest(BaseModel): - app_id: str - env: str - -# #get user by email & doc Office ID -# @router.get("/users/profile/{email}", tags="users") -# async def read_all_users(email: str, session: SessionContainer = Depends(verify_session())): -# db = mih_database.dbConnection.dbAppDataConnect() -# cursor = db.cursor() -# query = "SELECT * FROM users where email = %s" -# cursor.execute(query, (email.lower(),)) -# items = [ -# {"idusers": item[0], -# "email": item[1], -# "docOffice_id": item[2], -# "fname":item[3], -# "lname":item[4], -# "type": item[5], -# "app_id": item[6], -# "username": item[7], -# } -# for item in cursor.fetchall() -# ]# -# cursor.close() -# db.close() -# return items[0] - - - -@router.get("/users/count/", tags=["MIH Users"]) -async def read_users_by_app_id(): #, session: SessionContainer = Depends(verify_session()) - dbEngine = mih_database.mihDbConnections.dbAllConnect() - dbSession = Session(dbEngine) - try: - queryResults = dbSession.query(func.count(User.app_id)).scalar() - response_data = {"count": queryResults} - return response_data - except Exception as e: - print(f"An error occurred during the ORM query: {e}") - if dbSession.is_active: - dbSession.rollback() - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail="Failed to retrieve records due to an internal server error." - ) - finally: - dbSession.close() - -# Get List of all files -@router.get("/users/search/{search}", tags=["MIH Users"]) -async def read_all_users(search: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbAppDataConnect() - cursor = db.cursor() - query = "" - query += "SELECT * FROM users " - query += "WHERE (LOWER(email) LIKE %s OR LOWER(username) LIKE %s " - query += "OR LOWER(fname) LIKE %s OR LOWER(lname) LIKE %s " - query += "OR LOWER(purpose) LIKE %s) " - query += "AND username != ''" - search_term = f"%{search.lower()}%" # Add wildcards and lowercase - cursor.execute(query, (search_term, search_term,search_term, search_term, search_term)) - items = [ - { - "idUser": item[0], - "email": item[1], - "fname": item[2], - "lname": item[3], - "type": item[4], - "app_id": item[5], - "username": item[6], - "pro_pic_path": item[7], - "purpose": item[8], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items - -# Get List of all files -@router.get("/users/validate/username/{username}", tags=["MIH Users"]) -async def read_all_users(username: str, session: SessionContainer = Depends(verify_session()) ): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbAppDataConnect() - cursor = db.cursor() - query = "SELECT * FROM users WHERE LOWER(username) = %s" - # search_term = f"%{username.lower()}%" # Add wildcards and lowercase - cursor.execute(query, (username.lower(),)) - available = cursor.fetchone() is None - cursor.close() - db.close() - return {"available": available} - -# Get List of all files -@router.get("/user/{app_id}", tags=["MIH Users"]) -async def read_users_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())): - db = mih_database.dbConnection.dbAppDataConnect() - cursor = db.cursor() - query = "SELECT * FROM users where app_id = %s" - cursor.execute(query, (app_id,)) - items = [ - { - "idUser": item[0], - "email": item[1], - "fname": item[2], - "lname": item[3], - "type": item[4], - "app_id": item[5], - "username": item[6], - "pro_pic_path": item[7], - "purpose": item[8], - } - for item in cursor.fetchall() - ] - cursor.close() - db.close() - return items[0] - -# Insert Patient into table -@router.post("/user/insert/", tags=["MIH Users"], status_code=201) -async def insert_User_details(itemRequest : userInsertRequest, session: SessionContainer = Depends(verify_session())): - db = mih_database.dbConnection.dbAppDataConnect() - cursor = db.cursor() - query = "insert into users " - query += "(email, fname, lname, type, app_id, username, pro_pic_path, purpose) " - query += "values (%s, %s, %s, %s, %s, %s, %s, %s)" - userData = (itemRequest.email,"","","personal", - itemRequest.app_id, "", "","") - try: - cursor.execute(query, userData) - except Exception as error: - raise HTTPException(status_code=404, detail="Failed to Create Record - " + error) - #return {"message": "Failed to Create Record"} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Created Record"} - -# Update User on table -@router.put("/user/update/v2/", tags=["MIH Users"]) -async def Update_User_details(itemRequest : userUpdateRequestV2, session: SessionContainer = Depends(verify_session())): - db = mih_database.dbConnection.dbAppDataConnect() - cursor = db.cursor() - query = "update users " - query += "set username=%s, fname=%s, lname=%s, type=%s, pro_pic_path=%s, purpose=%s " - query += "where idusers=%s" - userData = (itemRequest.username, - itemRequest.fnam, - itemRequest.lname, - itemRequest.type, - itemRequest.pro_pic_path, - itemRequest.purpose, - itemRequest.idusers, - ) - try: - cursor.execute(query, userData) - except Exception as error: - raise HTTPException(status_code=404, detail=error) - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Updated Record"} - -# Update User on table -@router.put("/user/update/", tags=["MIH Users"]) -async def Update_User_details(itemRequest : userUpdateRequest, session: SessionContainer = Depends(verify_session())): - db = mih_database.dbConnection.dbAppDataConnect() - cursor = db.cursor() - query = "update users " - query += "set username=%s, fname=%s, lname=%s, type=%s, pro_pic_path=%s " - query += "where idusers=%s" - userData = (itemRequest.username, - itemRequest.fnam, - itemRequest.lname, - itemRequest.type, - itemRequest.pro_pic_path, - itemRequest.idusers, - ) - try: - cursor.execute(query, userData) - except Exception as error: - raise HTTPException(status_code=404, detail=error) - #return {"query": query, "message": error} - db.commit() - cursor.close() - db.close() - return {"message": "Successfully Updated Record"} - -# Get List of all files -@router.delete("/user/delete/all/", tags=["MIH Users"]) -async def delete_users_data_by_app_id(itemRequest: userDeleteRequest, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session()) - db = mih_database.dbConnection.dbAllConnect() - cursor = db.cursor() - db.start_transaction() - try: - queries = [ - "DELETE FROM app_data.notifications where app_id = %s", - "DELETE FROM app_data.business_users where app_id = %s", - "DELETE FROM data_access.patient_business_access where app_id = %s", - "DELETE FROM mzansi_calendar.appointments where app_id = %s", - "DELETE FROM mzansi_wallet.loyalty_cards where app_id = %s", - "DELETE FROM patient_manager.patients where app_id = %s", - "DELETE FROM patient_manager.patient_notes where app_id = %s", - "DELETE FROM patient_manager.patient_files where app_id = %s", - "DELETE FROM patient_manager.claim_statement_file where app_id = %s", - "DELETE FROM app_data.user_consent where app_id = %s", - "DELETE FROM app_data.users where app_id = %s", - ] - # Delete user from all tables - for query in queries: - cursor.execute(query, (itemRequest.app_id,)) - # Delete user files - try: - client = Minio_Storage.minioConnection.minioConnect(itemRequest.env) - objects_to_delete = client.list_objects("mih", prefix=itemRequest.app_id, recursive=True) - for obj in objects_to_delete: - client.remove_object("mih", obj.object_name) - except Exception as error: - raise HTTPException(status_code=500, detail="Failed to delete files from Minio - " + str(error)) - # Delete user from SuperTokens - try: - await delete_user(itemRequest.app_id) - except Exception as error: - raise HTTPException(status_code=500, detail="Failed to delete user from SuperTokens - " + str(error)) - db.commit() - except Exception as error: - db.rollback() - raise HTTPException(status_code=500, detail=str(error)) - finally: - if cursor: - cursor.close() - if db: - db.close() - return {"message": "Successfully Deleted User Account, Data & Files"} diff --git a/mih_api_hub/temp_logofile b/mih_api_hub/temp_logofile deleted file mode 100644 index e361cd15..00000000 Binary files a/mih_api_hub/temp_logofile and /dev/null differ diff --git a/mih_ui/.gitignore b/mih_ui/.gitignore deleted file mode 100644 index 5af64235..00000000 --- a/mih_ui/.gitignore +++ /dev/null @@ -1,50 +0,0 @@ -.env - -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.build/ -.buildlog/ -.history -.svn/ -.swiftpm/ -migrate_working_dir/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -**/ios/Flutter/.last_build_id -.dart_tool/ -.flutter-plugins -.flutter-plugins-dependencies -.pub-cache/ -.pub/ -/build/ - -# Symbolication related -app.*.symbols - -# Obfuscation related -app.*.map.json - -# Android Studio will place build artifacts here -/android/app/debug -/android/app/profile -/android/app/release - -# Flutter config file -/config/ \ No newline at end of file diff --git a/mih_ui/.metadata b/mih_ui/.metadata deleted file mode 100644 index ee6984a4..00000000 --- a/mih_ui/.metadata +++ /dev/null @@ -1,30 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: "6fba2447e95c451518584c35e25f5433f14d888c" - channel: "stable" - -project_type: app - -# Tracks metadata for the flutter migrate command -migration: - platforms: - - platform: root - create_revision: 6fba2447e95c451518584c35e25f5433f14d888c - base_revision: 6fba2447e95c451518584c35e25f5433f14d888c - - platform: linux - create_revision: 6fba2447e95c451518584c35e25f5433f14d888c - base_revision: 6fba2447e95c451518584c35e25f5433f14d888c - - # User provided section - - # List of Local paths (relative to this file) that should be - # ignored by the migrate tool. - # - # Files that are not part of the templates will be ignored by default. - unmanaged_files: - - 'lib/main.dart' - - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/mih_ui/Dockerfile b/mih_ui/Dockerfile deleted file mode 100644 index fe4435fc..00000000 --- a/mih_ui/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -# --- STAGE 1: The Builder --- -FROM debian:latest AS build-env - -# Install necessary dependencies for Flutter -RUN apt-get update && apt-get install -y \ - curl git wget unzip libglu1-mesa fonts-droid-fallback python3 \ - && rm -rf /var/lib/apt/lists/* - -# Clone Flutter SDK -RUN git clone -b flutter-3.32-candidate.0 https://github.com/flutter/flutter.git /usr/local/flutter -ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}" - -# Build the Flutter web app -WORKDIR /app -COPY . . -RUN flutter config --enable-web -RUN flutter build web --release -t ./lib/main_prod.dart - -# --- STAGE 2: The Final Production Image --- -FROM nginx:alpine - -# Copy built files from the first stage -COPY --from=build-env /app/build/web /usr/share/nginx/html - -# Create the Nginx config inside the Dockerfile to handle SPA routing -RUN echo 'server { \ - listen 83; \ - location / { \ - root /usr/share/nginx/html; \ - index index.html; \ - try_files $uri $uri/ /index.html; \ - } \ - }' > /etc/nginx/conf.d/default.conf - -EXPOSE 83 -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/mih_ui/README.md b/mih_ui/README.md deleted file mode 100644 index 89e2c918..00000000 --- a/mih_ui/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# mzansi_innovation_hub - -A new Flutter project. - -## Getting Started - -This project is a starting point for a Flutter application. - -A few resources to get you started if this is your first Flutter project: - -- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) - -For help getting started with Flutter development, view the -[online documentation](https://docs.flutter.dev/), which offers tutorials, -samples, guidance on mobile development, and a full API reference. diff --git a/mih_ui/analysis_options.yaml b/mih_ui/analysis_options.yaml deleted file mode 100644 index 0d290213..00000000 --- a/mih_ui/analysis_options.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# This file configures the analyzer, which statically analyzes Dart code to -# check for errors, warnings, and lints. -# -# The issues identified by the analyzer are surfaced in the UI of Dart-enabled -# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be -# invoked from the command line by running `flutter analyze`. - -# The following line activates a set of recommended lints for Flutter apps, -# packages, and plugins designed to encourage good coding practices. -include: package:flutter_lints/flutter.yaml - -linter: - # The lint rules applied to this project can be customized in the - # section below to disable rules from the `package:flutter_lints/flutter.yaml` - # included above or to enable additional rules. A list of all available lints - # and their documentation is published at https://dart.dev/lints. - # - # Instead of disabling a lint rule for the entire project in the - # section below, it can also be suppressed for a single line of code - # or a specific dart file by using the `// ignore: name_of_lint` and - # `// ignore_for_file: name_of_lint` syntax on the line or in the file - # producing the lint. - rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options diff --git a/mih_ui/android/.gitignore b/mih_ui/android/.gitignore deleted file mode 100644 index be3943c9..00000000 --- a/mih_ui/android/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -gradle-wrapper.jar -/.gradle -/captures/ -/gradlew -/gradlew.bat -/local.properties -GeneratedPluginRegistrant.java -.cxx/ - -# Remember to never publicly share your keystore. -# See https://flutter.dev/to/reference-keystore -key.properties -**/*.keystore -**/*.jks diff --git a/mih_ui/android/app/build.gradle.kts b/mih_ui/android/app/build.gradle.kts deleted file mode 100644 index 0aea73ef..00000000 --- a/mih_ui/android/app/build.gradle.kts +++ /dev/null @@ -1,72 +0,0 @@ -import java.util.Properties -import java.io.FileInputStream - -plugins { - id("com.android.application") - // START: FlutterFire Configuration - id("com.google.gms.google-services") - // END: FlutterFire Configuration - id("kotlin-android") - // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. - id("dev.flutter.flutter-gradle-plugin") -} - -val keystoreProperties = Properties() -val keystorePropertiesFile = rootProject.file("key.properties") -if (keystorePropertiesFile.exists()) { - keystoreProperties.load(FileInputStream(keystorePropertiesFile)) -} - -android { - namespace = "za.co.mzansiinnovationhub.mih" - compileSdk = 35 - ndkVersion = "27.0.12077973" - // ndkVersion = flutter.ndkVersion - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_11.toString() - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId = "za.co.mzansiinnovationhub.mih" - // You can update the following values to match your application needs. - // For more information, see: https://flutter.dev/to/review-gradle-config. - minSdk = 23 - //minSdk = flutter.minSdkVersion - targetSdk = flutter.targetSdkVersion - versionCode = flutter.versionCode - versionName = flutter.versionName - } - - signingConfigs { - create("release") { - keyAlias = keystoreProperties["keyAlias"] as String - keyPassword = keystoreProperties["keyPassword"] as String - storeFile = keystoreProperties["storeFile"]?.let { file(it) } - storePassword = keystoreProperties["storePassword"] as String - } - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.getByName("release") - isMinifyEnabled = true - proguardFiles( - getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro" - ) - } - } -} - -flutter { - source = "../.." -} \ No newline at end of file diff --git a/mih_ui/android/app/google-services.json b/mih_ui/android/app/google-services.json deleted file mode 100644 index 4f9479a5..00000000 --- a/mih_ui/android/app/google-services.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "project_info": { - "project_number": "33677883408", - "project_id": "mzansi-innovation-hub", - "storage_bucket": "mzansi-innovation-hub.firebasestorage.app" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "1:33677883408:android:ebd8565991c56257223295", - "android_client_info": { - "package_name": "za.co.mzansiinnovationhub.mih" - } - }, - "oauth_client": [], - "api_key": [ - { - "current_key": "AIzaSyBUkjWdu9YcgiF-e9TC5hoiEoCjPyjA5hU" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [] - } - } - } - ], - "configuration_version": "1" -} \ No newline at end of file diff --git a/mih_ui/android/app/proguard-rules.pro b/mih_ui/android/app/proguard-rules.pro deleted file mode 100644 index d216aea2..00000000 --- a/mih_ui/android/app/proguard-rules.pro +++ /dev/null @@ -1,5 +0,0 @@ -# R8/ProGuard rules to prevent removal of necessary Facebook Infer annotations --keep class com.facebook.infer.annotation.** { *; } --keep interface com.facebook.infer.annotation.** { *; } --dontwarn com.facebook.infer.annotation.Nullsafe$Mode --dontwarn com.facebook.infer.annotation.Nullsafe \ No newline at end of file diff --git a/mih_ui/android/app/src/debug/AndroidManifest.xml b/mih_ui/android/app/src/debug/AndroidManifest.xml deleted file mode 100644 index 399f6981..00000000 --- a/mih_ui/android/app/src/debug/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/mih_ui/android/app/src/main/AndroidManifest.xml b/mih_ui/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index 0c66eab2..00000000 --- a/mih_ui/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mih_ui/android/app/src/main/kotlin/za/co/mzansiinnovationhub/mih/MainActivity.kt b/mih_ui/android/app/src/main/kotlin/za/co/mzansiinnovationhub/mih/MainActivity.kt deleted file mode 100644 index 17f9c2bd..00000000 --- a/mih_ui/android/app/src/main/kotlin/za/co/mzansiinnovationhub/mih/MainActivity.kt +++ /dev/null @@ -1,5 +0,0 @@ -package za.co.mzansiinnovationhub.mih - -import io.flutter.embedding.android.FlutterFragmentActivity - -class MainActivity : FlutterFragmentActivity() diff --git a/mih_ui/android/app/src/main/res/drawable-hdpi-v31/android12branding.png b/mih_ui/android/app/src/main/res/drawable-hdpi-v31/android12branding.png deleted file mode 100644 index 24b3d384..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-hdpi-v31/android12branding.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-hdpi/android12splash.png b/mih_ui/android/app/src/main/res/drawable-hdpi/android12splash.png deleted file mode 100644 index 4ddd18fe..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-hdpi/android12splash.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-hdpi/branding.png b/mih_ui/android/app/src/main/res/drawable-hdpi/branding.png deleted file mode 100644 index 24b3d384..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-hdpi/branding.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png b/mih_ui/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png deleted file mode 100644 index c2334020..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-hdpi/splash.png b/mih_ui/android/app/src/main/res/drawable-hdpi/splash.png deleted file mode 100644 index c8b90f04..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-hdpi/splash.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-mdpi-v31/android12branding.png b/mih_ui/android/app/src/main/res/drawable-mdpi-v31/android12branding.png deleted file mode 100644 index c82d522c..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-mdpi-v31/android12branding.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-mdpi/android12splash.png b/mih_ui/android/app/src/main/res/drawable-mdpi/android12splash.png deleted file mode 100644 index 40997e93..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-mdpi/android12splash.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-mdpi/branding.png b/mih_ui/android/app/src/main/res/drawable-mdpi/branding.png deleted file mode 100644 index c82d522c..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-mdpi/branding.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png b/mih_ui/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png deleted file mode 100644 index 7ba3e88d..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-mdpi/splash.png b/mih_ui/android/app/src/main/res/drawable-mdpi/splash.png deleted file mode 100644 index 53e4ced6..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-mdpi/splash.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-night-hdpi-v31/android12branding.png b/mih_ui/android/app/src/main/res/drawable-night-hdpi-v31/android12branding.png deleted file mode 100644 index 24b3d384..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-night-hdpi-v31/android12branding.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-night-hdpi/android12splash.png b/mih_ui/android/app/src/main/res/drawable-night-hdpi/android12splash.png deleted file mode 100644 index 4ddd18fe..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-night-hdpi/android12splash.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-night-mdpi-v31/android12branding.png b/mih_ui/android/app/src/main/res/drawable-night-mdpi-v31/android12branding.png deleted file mode 100644 index c82d522c..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-night-mdpi-v31/android12branding.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-night-mdpi/android12splash.png b/mih_ui/android/app/src/main/res/drawable-night-mdpi/android12splash.png deleted file mode 100644 index 40997e93..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-night-mdpi/android12splash.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-night-xhdpi-v31/android12branding.png b/mih_ui/android/app/src/main/res/drawable-night-xhdpi-v31/android12branding.png deleted file mode 100644 index 7d34377d..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-night-xhdpi-v31/android12branding.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-night-xhdpi/android12splash.png b/mih_ui/android/app/src/main/res/drawable-night-xhdpi/android12splash.png deleted file mode 100644 index bb5d224e..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-night-xhdpi/android12splash.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-night-xxhdpi-v31/android12branding.png b/mih_ui/android/app/src/main/res/drawable-night-xxhdpi-v31/android12branding.png deleted file mode 100644 index 844f6592..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-night-xxhdpi-v31/android12branding.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-night-xxhdpi/android12splash.png b/mih_ui/android/app/src/main/res/drawable-night-xxhdpi/android12splash.png deleted file mode 100644 index 0c7a601d..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-night-xxhdpi/android12splash.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-night-xxxhdpi-v31/android12branding.png b/mih_ui/android/app/src/main/res/drawable-night-xxxhdpi-v31/android12branding.png deleted file mode 100644 index f2d86a92..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-night-xxxhdpi-v31/android12branding.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-night-xxxhdpi/android12splash.png b/mih_ui/android/app/src/main/res/drawable-night-xxxhdpi/android12splash.png deleted file mode 100644 index 9aca4634..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-night-xxxhdpi/android12splash.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-v21/background.png b/mih_ui/android/app/src/main/res/drawable-v21/background.png deleted file mode 100644 index 83987bcc..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-v21/background.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-v21/launch_background.xml b/mih_ui/android/app/src/main/res/drawable-v21/launch_background.xml deleted file mode 100644 index 4a7ac36b..00000000 --- a/mih_ui/android/app/src/main/res/drawable-v21/launch_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/mih_ui/android/app/src/main/res/drawable-xhdpi-v31/android12branding.png b/mih_ui/android/app/src/main/res/drawable-xhdpi-v31/android12branding.png deleted file mode 100644 index 7d34377d..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-xhdpi-v31/android12branding.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-xhdpi/android12splash.png b/mih_ui/android/app/src/main/res/drawable-xhdpi/android12splash.png deleted file mode 100644 index bb5d224e..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-xhdpi/android12splash.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-xhdpi/branding.png b/mih_ui/android/app/src/main/res/drawable-xhdpi/branding.png deleted file mode 100644 index 7d34377d..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-xhdpi/branding.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png b/mih_ui/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png deleted file mode 100644 index 42375e79..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-xhdpi/splash.png b/mih_ui/android/app/src/main/res/drawable-xhdpi/splash.png deleted file mode 100644 index 5071f829..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-xhdpi/splash.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-xxhdpi-v31/android12branding.png b/mih_ui/android/app/src/main/res/drawable-xxhdpi-v31/android12branding.png deleted file mode 100644 index 844f6592..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-xxhdpi-v31/android12branding.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-xxhdpi/android12splash.png b/mih_ui/android/app/src/main/res/drawable-xxhdpi/android12splash.png deleted file mode 100644 index 0c7a601d..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-xxhdpi/android12splash.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-xxhdpi/branding.png b/mih_ui/android/app/src/main/res/drawable-xxhdpi/branding.png deleted file mode 100644 index 844f6592..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-xxhdpi/branding.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png b/mih_ui/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png deleted file mode 100644 index a025358b..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-xxhdpi/splash.png b/mih_ui/android/app/src/main/res/drawable-xxhdpi/splash.png deleted file mode 100644 index c198ddbf..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-xxhdpi/splash.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-xxxhdpi-v31/android12branding.png b/mih_ui/android/app/src/main/res/drawable-xxxhdpi-v31/android12branding.png deleted file mode 100644 index f2d86a92..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-xxxhdpi-v31/android12branding.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-xxxhdpi/android12splash.png b/mih_ui/android/app/src/main/res/drawable-xxxhdpi/android12splash.png deleted file mode 100644 index 9aca4634..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-xxxhdpi/android12splash.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-xxxhdpi/branding.png b/mih_ui/android/app/src/main/res/drawable-xxxhdpi/branding.png deleted file mode 100644 index f2d86a92..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-xxxhdpi/branding.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png b/mih_ui/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png deleted file mode 100644 index b3f25f77..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable-xxxhdpi/splash.png b/mih_ui/android/app/src/main/res/drawable-xxxhdpi/splash.png deleted file mode 100644 index a2709e12..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable-xxxhdpi/splash.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable/background.png b/mih_ui/android/app/src/main/res/drawable/background.png deleted file mode 100644 index 83987bcc..00000000 Binary files a/mih_ui/android/app/src/main/res/drawable/background.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/drawable/calculator.xml b/mih_ui/android/app/src/main/res/drawable/calculator.xml deleted file mode 100644 index 24464f94..00000000 --- a/mih_ui/android/app/src/main/res/drawable/calculator.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mih_ui/android/app/src/main/res/drawable/launch_background.xml b/mih_ui/android/app/src/main/res/drawable/launch_background.xml deleted file mode 100644 index 4a7ac36b..00000000 --- a/mih_ui/android/app/src/main/res/drawable/launch_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/mih_ui/android/app/src/main/res/drawable/mih_calculator_sc.xml b/mih_ui/android/app/src/main/res/drawable/mih_calculator_sc.xml deleted file mode 100644 index b881d937..00000000 --- a/mih_ui/android/app/src/main/res/drawable/mih_calculator_sc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/mih_ui/android/app/src/main/res/drawable/mih_home_sc.xml b/mih_ui/android/app/src/main/res/drawable/mih_home_sc.xml deleted file mode 100644 index 577d6937..00000000 --- a/mih_ui/android/app/src/main/res/drawable/mih_home_sc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/mih_ui/android/app/src/main/res/drawable/mih_logo.xml b/mih_ui/android/app/src/main/res/drawable/mih_logo.xml deleted file mode 100644 index e67a36d8..00000000 --- a/mih_ui/android/app/src/main/res/drawable/mih_logo.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - diff --git a/mih_ui/android/app/src/main/res/drawable/mzansi_ai.xml b/mih_ui/android/app/src/main/res/drawable/mzansi_ai.xml deleted file mode 100644 index 6aa32a86..00000000 --- a/mih_ui/android/app/src/main/res/drawable/mzansi_ai.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mih_ui/android/app/src/main/res/drawable/mzansi_ai_sc.xml b/mih_ui/android/app/src/main/res/drawable/mzansi_ai_sc.xml deleted file mode 100644 index 5cce8b99..00000000 --- a/mih_ui/android/app/src/main/res/drawable/mzansi_ai_sc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/mih_ui/android/app/src/main/res/drawable/mzansi_directory.xml b/mih_ui/android/app/src/main/res/drawable/mzansi_directory.xml deleted file mode 100644 index 1ee03963..00000000 --- a/mih_ui/android/app/src/main/res/drawable/mzansi_directory.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/mih_ui/android/app/src/main/res/drawable/mzansi_directory_sc.xml b/mih_ui/android/app/src/main/res/drawable/mzansi_directory_sc.xml deleted file mode 100644 index 74928e30..00000000 --- a/mih_ui/android/app/src/main/res/drawable/mzansi_directory_sc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/mih_ui/android/app/src/main/res/drawable/mzansi_wallet.xml b/mih_ui/android/app/src/main/res/drawable/mzansi_wallet.xml deleted file mode 100644 index c3681bf8..00000000 --- a/mih_ui/android/app/src/main/res/drawable/mzansi_wallet.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - diff --git a/mih_ui/android/app/src/main/res/drawable/mzansi_wallet_sc.xml b/mih_ui/android/app/src/main/res/drawable/mzansi_wallet_sc.xml deleted file mode 100644 index 9d0af1f3..00000000 --- a/mih_ui/android/app/src/main/res/drawable/mzansi_wallet_sc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/mih_ui/android/app/src/main/res/drawable/test.xml b/mih_ui/android/app/src/main/res/drawable/test.xml deleted file mode 100644 index 85ad1a93..00000000 --- a/mih_ui/android/app/src/main/res/drawable/test.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/mih_ui/android/app/src/main/res/mipmap-anydpi-v26/launcher_icon.xml b/mih_ui/android/app/src/main/res/mipmap-anydpi-v26/launcher_icon.xml deleted file mode 100644 index c79c58a3..00000000 --- a/mih_ui/android/app/src/main/res/mipmap-anydpi-v26/launcher_icon.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - diff --git a/mih_ui/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/mih_ui/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index db77bb4b..00000000 Binary files a/mih_ui/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/mipmap-hdpi/launcher_icon.png b/mih_ui/android/app/src/main/res/mipmap-hdpi/launcher_icon.png deleted file mode 100644 index a629ce16..00000000 Binary files a/mih_ui/android/app/src/main/res/mipmap-hdpi/launcher_icon.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/mih_ui/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 17987b79..00000000 Binary files a/mih_ui/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/mipmap-mdpi/launcher_icon.png b/mih_ui/android/app/src/main/res/mipmap-mdpi/launcher_icon.png deleted file mode 100644 index 93deda87..00000000 Binary files a/mih_ui/android/app/src/main/res/mipmap-mdpi/launcher_icon.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/mih_ui/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 09d43914..00000000 Binary files a/mih_ui/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png b/mih_ui/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png deleted file mode 100644 index bfda05d5..00000000 Binary files a/mih_ui/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/mih_ui/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index d5f1c8d3..00000000 Binary files a/mih_ui/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png b/mih_ui/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png deleted file mode 100644 index 51b6e608..00000000 Binary files a/mih_ui/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/mih_ui/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 4d6372ee..00000000 Binary files a/mih_ui/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png b/mih_ui/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png deleted file mode 100644 index adbce8e0..00000000 Binary files a/mih_ui/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png and /dev/null differ diff --git a/mih_ui/android/app/src/main/res/values-night-v31/styles.xml b/mih_ui/android/app/src/main/res/values-night-v31/styles.xml deleted file mode 100644 index cff181e0..00000000 --- a/mih_ui/android/app/src/main/res/values-night-v31/styles.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/mih_ui/android/app/src/main/res/values-night/styles.xml b/mih_ui/android/app/src/main/res/values-night/styles.xml deleted file mode 100644 index dbc9ea9f..00000000 --- a/mih_ui/android/app/src/main/res/values-night/styles.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/mih_ui/android/app/src/main/res/values-v31/styles.xml b/mih_ui/android/app/src/main/res/values-v31/styles.xml deleted file mode 100644 index ef7bfb4a..00000000 --- a/mih_ui/android/app/src/main/res/values-v31/styles.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/mih_ui/android/app/src/main/res/values/arrays.xml b/mih_ui/android/app/src/main/res/values/arrays.xml deleted file mode 100644 index 669016d1..00000000 --- a/mih_ui/android/app/src/main/res/values/arrays.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - @drawable/mih_home_sc - @drawable/mzansi_wallet_sc - @drawable/mzansi_ai_sc - @drawable/mih_calculator_sc - @drawable/mzansi_directory_sc - - \ No newline at end of file diff --git a/mih_ui/android/app/src/main/res/values/colors.xml b/mih_ui/android/app/src/main/res/values/colors.xml deleted file mode 100644 index 152a652e..00000000 --- a/mih_ui/android/app/src/main/res/values/colors.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - #3A4454 - - - - #3A4454 - #bedcfe - \ No newline at end of file diff --git a/mih_ui/android/app/src/main/res/values/styles.xml b/mih_ui/android/app/src/main/res/values/styles.xml deleted file mode 100644 index 0d1fa8fc..00000000 --- a/mih_ui/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/mih_ui/android/app/src/profile/AndroidManifest.xml b/mih_ui/android/app/src/profile/AndroidManifest.xml deleted file mode 100644 index 399f6981..00000000 --- a/mih_ui/android/app/src/profile/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/mih_ui/android/build.gradle.kts b/mih_ui/android/build.gradle.kts deleted file mode 100644 index 89176ef4..00000000 --- a/mih_ui/android/build.gradle.kts +++ /dev/null @@ -1,21 +0,0 @@ -allprojects { - repositories { - google() - mavenCentral() - } -} - -val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get() -rootProject.layout.buildDirectory.value(newBuildDir) - -subprojects { - val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) - project.layout.buildDirectory.value(newSubprojectBuildDir) -} -subprojects { - project.evaluationDependsOn(":app") -} - -tasks.register("clean") { - delete(rootProject.layout.buildDirectory) -} diff --git a/mih_ui/android/build/reports/problems/problems-report.html b/mih_ui/android/build/reports/problems/problems-report.html deleted file mode 100644 index 0784829f..00000000 --- a/mih_ui/android/build/reports/problems/problems-report.html +++ /dev/null @@ -1,663 +0,0 @@ - - - - - - - - - - - - - Gradle Configuration Cache - - - -
- -
- Loading... -
- - - - - - diff --git a/mih_ui/android/gradle.properties b/mih_ui/android/gradle.properties deleted file mode 100644 index f018a618..00000000 --- a/mih_ui/android/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError -android.useAndroidX=true -android.enableJetifier=true diff --git a/mih_ui/android/gradle/wrapper/gradle-wrapper.properties b/mih_ui/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index ac3b4792..00000000 --- a/mih_ui/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip diff --git a/mih_ui/android/settings.gradle.kts b/mih_ui/android/settings.gradle.kts deleted file mode 100644 index bd7522f7..00000000 --- a/mih_ui/android/settings.gradle.kts +++ /dev/null @@ -1,28 +0,0 @@ -pluginManagement { - val flutterSdkPath = run { - val properties = java.util.Properties() - file("local.properties").inputStream().use { properties.load(it) } - val flutterSdkPath = properties.getProperty("flutter.sdk") - require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } - flutterSdkPath - } - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -plugins { - id("dev.flutter.flutter-plugin-loader") version "1.0.0" - id("com.android.application") version "8.7.3" apply false - // START: FlutterFire Configuration - id("com.google.gms.google-services") version("4.3.15") apply false - // END: FlutterFire Configuration - id("org.jetbrains.kotlin.android") version "2.1.0" apply false -} - -include(":app") diff --git a/mih_ui/devtools_options.yaml b/mih_ui/devtools_options.yaml deleted file mode 100644 index 7e9e9477..00000000 --- a/mih_ui/devtools_options.yaml +++ /dev/null @@ -1,3 +0,0 @@ -description: This file stores settings for Dart & Flutter DevTools. -documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states -extensions: \ No newline at end of file diff --git a/mih_ui/firebase.json b/mih_ui/firebase.json deleted file mode 100644 index d3d23465..00000000 --- a/mih_ui/firebase.json +++ /dev/null @@ -1 +0,0 @@ -{"flutter":{"platforms":{"android":{"default":{"projectId":"mzansi-innovation-hub","appId":"1:33677883408:android:ebd8565991c56257223295","fileOutput":"android/app/google-services.json"}},"ios":{"default":{"projectId":"mzansi-innovation-hub","appId":"1:33677883408:ios:2048dac086428716223295","uploadDebugSymbols":false,"fileOutput":"ios/Runner/GoogleService-Info.plist"}},"macos":{"default":{"projectId":"mzansi-innovation-hub","appId":"1:33677883408:ios:e2db11a42fc3452e223295","uploadDebugSymbols":false,"fileOutput":"macos/Runner/GoogleService-Info.plist"}},"dart":{"lib/firebase_options.dart":{"projectId":"mzansi-innovation-hub","configurations":{"android":"1:33677883408:android:ebd8565991c56257223295","ios":"1:33677883408:ios:2048dac086428716223295","macos":"1:33677883408:ios:e2db11a42fc3452e223295","web":"1:33677883408:web:47b8021df7fcacd2223295","windows":"1:33677883408:web:e08becaef3261c59223295"}}}}}} \ No newline at end of file diff --git a/mih_ui/firepit-log.txt b/mih_ui/firepit-log.txt deleted file mode 100644 index cf8334ba..00000000 --- a/mih_ui/firepit-log.txt +++ /dev/null @@ -1,13 +0,0 @@ -Welcome to firepit v1.1.0! -Doing JSON parses for version checks at /snapshot/firepit/vendor/node_modules/firebase-tools/package.json -is-ci,mime,rc,yaml,abbrev,abort-controller,accepts,acorn,acorn-walk,agent-base,ajv,ajv-formats,ansi-align,ansi-escapes,ansi-regex,ansi-styles,any-promise,anymatch,archiver,archiver-utils,arg,argparse,array-flatten,arrify,as-array,ast-types,async,async-lock,asynckit,b4a,balanced-match,bare-events,base64-js,basic-auth,basic-auth-connect,basic-ftp,bignumber.js,binary-extensions,bl,body-parser,boxen,brace-expansion,braces,buffer,buffer-crc32,buffer-equal-constant-time,bytes,cacache,call-bind-apply-helpers,call-bound,call-me-maybe,camelcase,chalk,char-regex,chardet,chokidar,chownr,ci-info,cjson,cli-boxes,cli-cursor,cli-highlight,cli-spinners,cli-table3,cli-width,cliui,clone,color,color-convert,color-name,color-string,colorette,combined-stream,commander,compress-commons,compressible,compression,concat-map,config-chain,configstore,connect,content-disposition,content-type,cookie,cookie-signature,core-util-is,cors,crc-32,crc32-stream,create-require,cross-env,cross-spawn,crypto-random-string,csv-parse,data-uri-to-buffer,debug,deep-equal-in-any-order,deep-extend,deep-freeze,deep-is,defaults,degenerator,delayed-stream,depd,destroy,diff,discontinuous-range,dot-prop,dunder-proto,duplexify,eastasianwidth,ecdsa-sig-formatter,ee-first,emoji-regex,emojilib,enabled,encodeurl,encoding,end-of-stream,env-paths,environment,err-code,es-define-property,es-errors,es-object-atoms,es-set-tostringtag,escalade,escape-goat,escape-html,escodegen,esprima,estraverse,esutils,etag,event-target-shim,events,events-listener,events-universal,eventsource,eventsource-parser,exegesis,exegesis-express,exponential-backoff,express,express-rate-limit,extend,fast-deep-equal,fast-fifo,fast-uri,fecha,fetch-blob,filesize,fill-range,finalhandler,firebase-tools,fn.name,foreground-child,form-data,formdata-polyfill,forwarded,fresh,fs-extra,fs-minipass,function-bind,fuzzy,gaxios,gcp-metadata,get-caller-file,get-intrinsic,get-proto,get-uri,glob,glob-parent,glob-slash,glob-slasher,global-dirs,google-auth-library,google-gax,google-logging-utils,googleapis-common,gopd,graceful-fs,gtoken,has-flag,has-symbols,has-tostringtag,has-yarn,hasown,heap-js,highlight.js,hosted-git-info,http-cache-semantics,http-errors,http-proxy-agent,https-proxy-agent,iconv-lite,ieee754,ignore,import-lazy,imurmurhash,infer-owner,inherits,ini,install-artifact-from-github,ip-address,ip-regex,ipaddr.js,is-binary-path,is-buffer,is-extglob,is-fullwidth-code-point,is-glob,is-installed-globally,is-interactive,is-npm,is-number,is-obj,is-path-inside,is-promise,is-stream,is-stream-ended,is-typedarray,is-unicode-supported,is-url,is-wsl,is-yarn-global,is2,isarray,isexe,isomorphic-fetch,jackspeak,jju,join-path,jose,js-yaml,json-bigint,json-parse-helpfulerror,json-ptr,json-schema-traverse,jsonfile,jsonwebtoken,jwa,jws,kind-of,kuler,lazystream,leven,libsodium,libsodium-wrappers,lodash,lodash._objecttypes,lodash.camelcase,lodash.includes,lodash.isboolean,lodash.isinteger,lodash.isnumber,lodash.isobject,lodash.isplainobject,lodash.isstring,lodash.mapvalues,lodash.once,lodash.snakecase,log-symbols,logform,long,lru-cache,lsofi,make-dir,make-error,make-fetch-happen,marked,marked-terminal,math-intrinsics,media-typer,merge-descriptors,methods,mime-db,mime-types,mimic-fn,minimatch,minimist,minipass,minipass-collect,minipass-fetch,minipass-flush,minipass-pipeline,minipass-sized,minizlib,mkdirp,moo,morgan,ms,mute-stream,mz,nan,nearley,negotiator,netmask,node-domexception,node-emoji,node-fetch,node-gyp,nopt,normalize-path,npm-install-checks,npm-normalize-package-bin,npm-package-arg,npm-pick-manifest,object-assign,object-hash,object-inspect,on-finished,on-headers,once,one-time,onetime,open,openapi3-ts,ora,p-defer,p-limit,p-map,p-throttle,pac-proxy-agent,pac-resolver,package-json-from-dist,parse5,parse5-htmlparser2-tree-adapter,parseurl,path-key,path-scurry,path-to-regexp,pg,pg-cloudflare,pg-connection-string,pg-gateway,pg-int8,pg-pool,pg-protocol,pg-types,pglite-2,pgpass,picomatch,pkce-challenge,portfinder,postgres-array,postgres-bytea,postgres-date,postgres-interval,proc-log,process,process-nextick-args,progress,promise-breaker,promise-retry,proto-list,proto3-json-serializer,protobufjs,proxy-addr,proxy-agent,proxy-from-env,pupa,qs,railroad-diagrams,randexp,range-parser,raw-body,re2,readable-stream,readdir-glob,readdirp,registry-auth-token,registry-url,require-directory,require-from-string,restore-cursor,ret,retry,retry-request,rimraf,router,safe-buffer,safe-stable-stringify,safer-buffer,semver,semver-diff,send,serve-static,setprototypeof,shebang-command,shebang-regex,side-channel,side-channel-list,side-channel-map,side-channel-weakmap,signal-exit,skin-tone,smart-buffer,socks,socks-proxy-agent,sort-any,source-map,split2,sprintf-js,sql-formatter,ssri,stack-trace,statuses,stream-chain,stream-events,stream-json,stream-shift,streamx,string-width,string-width-cjs,string_decoder,strip-ansi,strip-ansi-cjs,strip-json-comments,stubs,superstatic,supports-color,supports-hyperlinks,tar,tar-stream,tcp-port-used,teeny-request,text-decoder,text-hex,thenify,thenify-all,through2,tinyglobby,tmp,to-regex-range,toidentifier,toxic,tr46,triple-beam,ts-node,tslib,tsscmp,type-fest,type-is,typedarray-to-buffer,typescript,undici-types,unicode-emoji-modifier-base,unique-filename,unique-slug,unique-string,universal-analytics,universalify,unpipe,update-notifier-cjs,url-join,url-template,util-deprecate,utils-merge,uuid,v8-compile-cache-lib,valid-url,validate-npm-package-name,vary,wcwidth,web-streams-polyfill,webidl-conversions,whatwg-fetch,whatwg-url,which,widest-line,winston,winston-transport,wrap-ansi,wrap-ansi-cjs,wrappy,write-file-atomic,ws,xdg-basedir,xtend,y18n,yallist,yargs,yargs-parser,yn,yocto-queue,yoctocolors-cjs,zip-stream,zod,zod-to-json-schema,@apidevtools,@apphosting,@colors,@cspotcode,@dabh,@electric-sql,@google-cloud,@googleapis,@grpc,@inquirer,@isaacs,@jridgewell,@js-sdsl,@jsdevtools,@modelcontextprotocol,@npmcli,@opentelemetry,@pkgjs,@pnpm,@protobufjs,@sindresorhus,@so-ric,@tootallnate,@tsconfig,@types -Installed ft@14.27.0 and packaged ft@14.27.0 -Checking for npm/bin/npm-cli install at /home/yaso/.cache/firebase/tools/lib/node_modules/npm/bin/npm-cli -Checking for npm/bin/npm-cli install at /home/yaso/.cache/firebase/tools/node_modules/npm/bin/npm-cli -Checking for npm/bin/npm-cli install at /snapshot/firepit/node_modules/npm/bin/npm-cli -Found npm/bin/npm-cli install. -Checking for npm/bin/npm-cli install at /home/yaso/.cache/firebase/tools/lib/node_modules/npm/bin/npm-cli -Checking for npm/bin/npm-cli install at /home/yaso/.cache/firebase/tools/node_modules/npm/bin/npm-cli -Checking for npm/bin/npm-cli install at /snapshot/firepit/node_modules/npm/bin/npm-cli -Found npm/bin/npm-cli install. -ShellJSInternalError: ENOENT: no such file or directory, chmod '/home/yaso/.cache/firebase/runtime/shell' \ No newline at end of file diff --git a/mih_ui/flutter_launcher_icons.yaml b/mih_ui/flutter_launcher_icons.yaml deleted file mode 100644 index c64c3808..00000000 --- a/mih_ui/flutter_launcher_icons.yaml +++ /dev/null @@ -1,46 +0,0 @@ -# flutter pub run flutter_launcher_icons -flutter_launcher_icons: - # Original - image_path: "lib/mih_package_components/assets/images/app_icon/mih_logo_app.png" - - # Women For Change - # image_path: "lib/mih_package_components/assets/images/app_icon/mih_logo_app_w4c.png" - - android: "launcher_icon" - min_sdk_android: 21 # android min sdk min:16, default 21 - # Original - adaptive_icon_background: "#3A4454" - adaptive_icon_foreground: "lib/mih_package_components/assets/images/app_icon/mih_logo_app.png" - - # Women For Change - # adaptive_icon_background: "#6641b2" - # adaptive_icon_foreground: "lib/mih_package_components/assets/images/app_icon/mih_logo_app_w4c.png" - - ios: true - # Original - image_path_ios: "lib/mih_package_components/assets/images/app_icon/mih_logo_app.png" - - # Women For Change - # image_path_ios: "lib/mih_package_components/assets/images/app_icon/mih_logo_app_w4c.png" - remove_alpha_channel_ios: true - - web: - generate: true - # Original - image_path: "lib/mih_package_components/assets/images/app_icon/mih_logo_web.png" - background_color: "#3A4454" - theme_color: "#3A4454" - - # Women For Change - # image_path: "lib/mih_package_components/assets/images/app_icon/mih_logo_web_w4c.png" - # background_color: "#6641b2" - # theme_color: "#6641b2" - - windows: - generate: true - image_path: "lib/mih_package_components/assets/images/app_icon/mih_logo_web.png" - icon_size: 48 # min:48, max:256, default: 48 - - macos: - generate: true - image_path: "lib/mih_package_components/assets/images/app_icon/mih_logo_web.png" diff --git a/mih_ui/ios/.gitignore b/mih_ui/ios/.gitignore deleted file mode 100644 index 7a7f9873..00000000 --- a/mih_ui/ios/.gitignore +++ /dev/null @@ -1,34 +0,0 @@ -**/dgph -*.mode1v3 -*.mode2v3 -*.moved-aside -*.pbxuser -*.perspectivev3 -**/*sync/ -.sconsign.dblite -.tags* -**/.vagrant/ -**/DerivedData/ -Icon? -**/Pods/ -**/.symlinks/ -profile -xcuserdata -**/.generated/ -Flutter/App.framework -Flutter/Flutter.framework -Flutter/Flutter.podspec -Flutter/Generated.xcconfig -Flutter/ephemeral/ -Flutter/app.flx -Flutter/app.zip -Flutter/flutter_assets/ -Flutter/flutter_export_environment.sh -ServiceDefinitions.json -Runner/GeneratedPluginRegistrant.* - -# Exceptions to above rules. -!default.mode1v3 -!default.mode2v3 -!default.pbxuser -!default.perspectivev3 diff --git a/mih_ui/ios/Flutter/AppFrameworkInfo.plist b/mih_ui/ios/Flutter/AppFrameworkInfo.plist deleted file mode 100644 index 7c569640..00000000 --- a/mih_ui/ios/Flutter/AppFrameworkInfo.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - App - CFBundleIdentifier - io.flutter.flutter.app - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - App - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - MinimumOSVersion - 12.0 - - diff --git a/mih_ui/ios/Flutter/Debug.xcconfig b/mih_ui/ios/Flutter/Debug.xcconfig deleted file mode 100644 index ec97fc6f..00000000 --- a/mih_ui/ios/Flutter/Debug.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" -#include "Generated.xcconfig" diff --git a/mih_ui/ios/Flutter/Release.xcconfig b/mih_ui/ios/Flutter/Release.xcconfig deleted file mode 100644 index c4855bfe..00000000 --- a/mih_ui/ios/Flutter/Release.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" -#include "Generated.xcconfig" diff --git a/mih_ui/ios/Podfile b/mih_ui/ios/Podfile deleted file mode 100644 index aff73eea..00000000 --- a/mih_ui/ios/Podfile +++ /dev/null @@ -1,43 +0,0 @@ -# Uncomment this line to define a global platform for your project -platform :ios, '15.5.0' - -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -project 'Runner', { - 'Debug' => :debug, - 'Profile' => :release, - 'Release' => :release, -} - -def flutter_root - generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) - unless File.exist?(generated_xcode_build_settings_path) - raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" - end - - File.foreach(generated_xcode_build_settings_path) do |line| - matches = line.match(/FLUTTER_ROOT\=(.*)/) - return matches[1].strip if matches - end - raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" -end - -require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) - -flutter_ios_podfile_setup - -target 'Runner' do - use_frameworks! - - flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) - target 'RunnerTests' do - inherit! :search_paths - end -end - -post_install do |installer| - installer.pods_project.targets.each do |target| - flutter_additional_ios_build_settings(target) - end -end diff --git a/mih_ui/ios/Podfile.lock b/mih_ui/ios/Podfile.lock deleted file mode 100644 index 9d987bad..00000000 --- a/mih_ui/ios/Podfile.lock +++ /dev/null @@ -1,361 +0,0 @@ -PODS: - - app_settings (5.1.1): - - Flutter - - AppCheckCore (11.2.0): - - GoogleUtilities/Environment (~> 8.0) - - GoogleUtilities/UserDefaults (~> 8.0) - - PromisesObjC (~> 2.4) - - camera_avfoundation (0.0.1): - - Flutter - - device_info_plus (0.0.1): - - Flutter - - DKImagePickerController/Core (4.3.9): - - DKImagePickerController/ImageDataManager - - DKImagePickerController/Resource - - DKImagePickerController/ImageDataManager (4.3.9) - - DKImagePickerController/PhotoGallery (4.3.9): - - DKImagePickerController/Core - - DKPhotoGallery - - DKImagePickerController/Resource (4.3.9) - - DKPhotoGallery (0.0.19): - - DKPhotoGallery/Core (= 0.0.19) - - DKPhotoGallery/Model (= 0.0.19) - - DKPhotoGallery/Preview (= 0.0.19) - - DKPhotoGallery/Resource (= 0.0.19) - - SDWebImage - - SwiftyGif - - DKPhotoGallery/Core (0.0.19): - - DKPhotoGallery/Model - - DKPhotoGallery/Preview - - SDWebImage - - SwiftyGif - - DKPhotoGallery/Model (0.0.19): - - SDWebImage - - SwiftyGif - - DKPhotoGallery/Preview (0.0.19): - - DKPhotoGallery/Model - - DKPhotoGallery/Resource - - SDWebImage - - SwiftyGif - - DKPhotoGallery/Resource (0.0.19): - - SDWebImage - - SwiftyGif - - FBAudienceNetwork (6.20.1) - - file_picker (0.0.1): - - DKImagePickerController/PhotoGallery - - Flutter - - file_saver (0.0.1): - - Flutter - - file_selector_ios (0.0.1): - - Flutter - - Firebase/Auth (12.8.0): - - Firebase/CoreOnly - - FirebaseAuth (~> 12.8.0) - - Firebase/CoreOnly (12.8.0): - - FirebaseCore (~> 12.8.0) - - firebase_app_check (0.4.1-2): - - Firebase/CoreOnly (~> 12.8.0) - - firebase_core - - FirebaseAppCheck (~> 12.8.0) - - Flutter - - firebase_auth (6.1.2): - - Firebase/Auth (= 12.8.0) - - firebase_core - - Flutter - - firebase_core (4.4.0): - - Firebase/CoreOnly (= 12.8.0) - - Flutter - - FirebaseAppCheck (12.8.0): - - AppCheckCore (~> 11.0) - - FirebaseAppCheckInterop (~> 12.8.0) - - FirebaseCore (~> 12.8.0) - - GoogleUtilities/Environment (~> 8.1) - - GoogleUtilities/UserDefaults (~> 8.1) - - FirebaseAppCheckInterop (12.8.0) - - FirebaseAuth (12.8.0): - - FirebaseAppCheckInterop (~> 12.8.0) - - FirebaseAuthInterop (~> 12.8.0) - - FirebaseCore (~> 12.8.0) - - FirebaseCoreExtension (~> 12.8.0) - - GoogleUtilities/AppDelegateSwizzler (~> 8.1) - - GoogleUtilities/Environment (~> 8.1) - - GTMSessionFetcher/Core (< 6.0, >= 3.4) - - RecaptchaInterop (~> 101.0) - - FirebaseAuthInterop (12.8.0) - - FirebaseCore (12.8.0): - - FirebaseCoreInternal (~> 12.8.0) - - GoogleUtilities/Environment (~> 8.1) - - GoogleUtilities/Logger (~> 8.1) - - FirebaseCoreExtension (12.8.0): - - FirebaseCore (~> 12.8.0) - - FirebaseCoreInternal (12.8.0): - - "GoogleUtilities/NSData+zlib (~> 8.1)" - - fl_downloader (0.0.1): - - Flutter - - Flutter (1.0.0) - - flutter_native_splash (2.4.3): - - Flutter - - flutter_tts (0.0.1): - - Flutter - - geolocator_apple (1.2.0): - - Flutter - - FlutterMacOS - - gma_mediation_meta (1.4.1): - - Flutter - - GoogleMobileAdsMediationFacebook (~> 6.20.1.0) - - Google-Mobile-Ads-SDK (12.2.0): - - GoogleUserMessagingPlatform (>= 1.1) - - google_mobile_ads (6.0.0): - - Flutter - - Google-Mobile-Ads-SDK (~> 12.2.0) - - webview_flutter_wkwebview - - GoogleMobileAdsMediationFacebook (6.20.1.0): - - FBAudienceNetwork (= 6.20.1) - - Google-Mobile-Ads-SDK (~> 12.0) - - GoogleUserMessagingPlatform (3.1.0) - - GoogleUtilities/AppDelegateSwizzler (8.1.0): - - GoogleUtilities/Environment - - GoogleUtilities/Logger - - GoogleUtilities/Network - - GoogleUtilities/Privacy - - GoogleUtilities/Environment (8.1.0): - - GoogleUtilities/Privacy - - GoogleUtilities/Logger (8.1.0): - - GoogleUtilities/Environment - - GoogleUtilities/Privacy - - GoogleUtilities/Network (8.1.0): - - GoogleUtilities/Logger - - "GoogleUtilities/NSData+zlib" - - GoogleUtilities/Privacy - - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (8.1.0)": - - GoogleUtilities/Privacy - - GoogleUtilities/Privacy (8.1.0) - - GoogleUtilities/Reachability (8.1.0): - - GoogleUtilities/Logger - - GoogleUtilities/Privacy - - GoogleUtilities/UserDefaults (8.1.0): - - GoogleUtilities/Logger - - GoogleUtilities/Privacy - - GTMSessionFetcher/Core (5.0.0) - - image_picker_ios (0.0.1): - - Flutter - - local_auth_darwin (0.0.1): - - Flutter - - FlutterMacOS - - mobile_scanner (7.0.0): - - Flutter - - FlutterMacOS - - package_info_plus (0.4.5): - - Flutter - - path_provider_foundation (0.0.1): - - Flutter - - FlutterMacOS - - printing (1.0.0): - - Flutter - - PromisesObjC (2.4.0) - - quick_actions_ios (0.0.1): - - Flutter - - RecaptchaInterop (101.0.0) - - record_ios (1.1.0): - - Flutter - - screen_brightness_ios (0.1.0): - - Flutter - - SDWebImage (5.21.5): - - SDWebImage/Core (= 5.21.5) - - SDWebImage/Core (5.21.5) - - share_plus (0.0.1): - - Flutter - - shared_preferences_foundation (0.0.1): - - Flutter - - FlutterMacOS - - sqflite_darwin (0.0.4): - - Flutter - - FlutterMacOS - - SwiftyGif (5.4.5) - - syncfusion_flutter_pdfviewer (0.0.1): - - Flutter - - url_launcher_ios (0.0.1): - - Flutter - - webview_flutter_wkwebview (0.0.1): - - Flutter - - FlutterMacOS - -DEPENDENCIES: - - app_settings (from `.symlinks/plugins/app_settings/ios`) - - camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`) - - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) - - file_picker (from `.symlinks/plugins/file_picker/ios`) - - file_saver (from `.symlinks/plugins/file_saver/ios`) - - file_selector_ios (from `.symlinks/plugins/file_selector_ios/ios`) - - firebase_app_check (from `.symlinks/plugins/firebase_app_check/ios`) - - firebase_auth (from `.symlinks/plugins/firebase_auth/ios`) - - firebase_core (from `.symlinks/plugins/firebase_core/ios`) - - fl_downloader (from `.symlinks/plugins/fl_downloader/ios`) - - Flutter (from `Flutter`) - - flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`) - - flutter_tts (from `.symlinks/plugins/flutter_tts/ios`) - - geolocator_apple (from `.symlinks/plugins/geolocator_apple/darwin`) - - gma_mediation_meta (from `.symlinks/plugins/gma_mediation_meta/ios`) - - google_mobile_ads (from `.symlinks/plugins/google_mobile_ads/ios`) - - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - - local_auth_darwin (from `.symlinks/plugins/local_auth_darwin/darwin`) - - mobile_scanner (from `.symlinks/plugins/mobile_scanner/darwin`) - - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - - printing (from `.symlinks/plugins/printing/ios`) - - quick_actions_ios (from `.symlinks/plugins/quick_actions_ios/ios`) - - record_ios (from `.symlinks/plugins/record_ios/ios`) - - screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`) - - share_plus (from `.symlinks/plugins/share_plus/ios`) - - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - - sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`) - - syncfusion_flutter_pdfviewer (from `.symlinks/plugins/syncfusion_flutter_pdfviewer/ios`) - - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) - - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/darwin`) - -SPEC REPOS: - trunk: - - AppCheckCore - - DKImagePickerController - - DKPhotoGallery - - FBAudienceNetwork - - Firebase - - FirebaseAppCheck - - FirebaseAppCheckInterop - - FirebaseAuth - - FirebaseAuthInterop - - FirebaseCore - - FirebaseCoreExtension - - FirebaseCoreInternal - - Google-Mobile-Ads-SDK - - GoogleMobileAdsMediationFacebook - - GoogleUserMessagingPlatform - - GoogleUtilities - - GTMSessionFetcher - - PromisesObjC - - RecaptchaInterop - - SDWebImage - - SwiftyGif - -EXTERNAL SOURCES: - app_settings: - :path: ".symlinks/plugins/app_settings/ios" - camera_avfoundation: - :path: ".symlinks/plugins/camera_avfoundation/ios" - device_info_plus: - :path: ".symlinks/plugins/device_info_plus/ios" - file_picker: - :path: ".symlinks/plugins/file_picker/ios" - file_saver: - :path: ".symlinks/plugins/file_saver/ios" - file_selector_ios: - :path: ".symlinks/plugins/file_selector_ios/ios" - firebase_app_check: - :path: ".symlinks/plugins/firebase_app_check/ios" - firebase_auth: - :path: ".symlinks/plugins/firebase_auth/ios" - firebase_core: - :path: ".symlinks/plugins/firebase_core/ios" - fl_downloader: - :path: ".symlinks/plugins/fl_downloader/ios" - Flutter: - :path: Flutter - flutter_native_splash: - :path: ".symlinks/plugins/flutter_native_splash/ios" - flutter_tts: - :path: ".symlinks/plugins/flutter_tts/ios" - geolocator_apple: - :path: ".symlinks/plugins/geolocator_apple/darwin" - gma_mediation_meta: - :path: ".symlinks/plugins/gma_mediation_meta/ios" - google_mobile_ads: - :path: ".symlinks/plugins/google_mobile_ads/ios" - image_picker_ios: - :path: ".symlinks/plugins/image_picker_ios/ios" - local_auth_darwin: - :path: ".symlinks/plugins/local_auth_darwin/darwin" - mobile_scanner: - :path: ".symlinks/plugins/mobile_scanner/darwin" - package_info_plus: - :path: ".symlinks/plugins/package_info_plus/ios" - path_provider_foundation: - :path: ".symlinks/plugins/path_provider_foundation/darwin" - printing: - :path: ".symlinks/plugins/printing/ios" - quick_actions_ios: - :path: ".symlinks/plugins/quick_actions_ios/ios" - record_ios: - :path: ".symlinks/plugins/record_ios/ios" - screen_brightness_ios: - :path: ".symlinks/plugins/screen_brightness_ios/ios" - share_plus: - :path: ".symlinks/plugins/share_plus/ios" - shared_preferences_foundation: - :path: ".symlinks/plugins/shared_preferences_foundation/darwin" - sqflite_darwin: - :path: ".symlinks/plugins/sqflite_darwin/darwin" - syncfusion_flutter_pdfviewer: - :path: ".symlinks/plugins/syncfusion_flutter_pdfviewer/ios" - url_launcher_ios: - :path: ".symlinks/plugins/url_launcher_ios/ios" - webview_flutter_wkwebview: - :path: ".symlinks/plugins/webview_flutter_wkwebview/darwin" - -SPEC CHECKSUMS: - app_settings: 5127ae0678de1dcc19f2293271c51d37c89428b2 - AppCheckCore: cc8fd0a3a230ddd401f326489c99990b013f0c4f - camera_avfoundation: be3be85408cd4126f250386828e9b1dfa40ab436 - device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe - DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c - DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60 - FBAudienceNetwork: 08e86d63a05b3a5a59414af12e4af8d756943c80 - file_picker: a0560bc09d61de87f12d246fc47d2119e6ef37be - file_saver: 6cdbcddd690cb02b0c1a0c225b37cd805c2bf8b6 - file_selector_ios: f92e583d43608aebc2e4a18daac30b8902845502 - Firebase: 9a58fdbc9d8655ed7b79a19cf9690bb007d3d46d - firebase_app_check: 9756167f67afd4844027314bea522e42599631b5 - firebase_auth: 2ebdb4dbe0da3a75585694dcba711f7a8a926601 - firebase_core: ee30637e6744af8e0c12a6a1e8a9718506ec2398 - FirebaseAppCheck: 11da425929a45c677d537adfff3520ccd57c1690 - FirebaseAppCheckInterop: ba3dc604a89815379e61ec2365101608d365cf7d - FirebaseAuth: 4c289b1a43f5955283244a55cf6bd616de344be5 - FirebaseAuthInterop: 95363fe96493cb4f106656666a0768b420cba090 - FirebaseCore: 0dbad74bda10b8fb9ca34ad8f375fb9dd3ebef7c - FirebaseCoreExtension: 6605938d51f765d8b18bfcafd2085276a252bee2 - FirebaseCoreInternal: fe5fa466aeb314787093a7dce9f0beeaad5a2a21 - fl_downloader: dc99aa8dd303f862cccb830087f37acc9b0156ee - Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - flutter_native_splash: c32d145d68aeda5502d5f543ee38c192065986cf - flutter_tts: b88dbc8655d3dc961bc4a796e4e16a4cc1795833 - geolocator_apple: ab36aa0e8b7d7a2d7639b3b4e48308394e8cef5e - gma_mediation_meta: 44defcf3b61414cdca65c0f897360e31b9332a09 - Google-Mobile-Ads-SDK: 1dfb0c3cb46c7e2b00b0f4de74a1e06d9ea25d67 - google_mobile_ads: 535223588a6791b7a3cc3513a1bc7b89d12f3e62 - GoogleMobileAdsMediationFacebook: b11a92ae3bfdae19853b882252b7e62791c18162 - GoogleUserMessagingPlatform: befe603da6501006420c206222acd449bba45a9c - GoogleUtilities: 00c88b9a86066ef77f0da2fab05f65d7768ed8e1 - GTMSessionFetcher: 02d6e866e90bc236f48a703a041dfe43e6221a29 - image_picker_ios: 7fe1ff8e34c1790d6fff70a32484959f563a928a - local_auth_darwin: 553ce4f9b16d3fdfeafce9cf042e7c9f77c1c391 - mobile_scanner: 9157936403f5a0644ca3779a38ff8404c5434a93 - package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499 - path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564 - printing: 54ff03f28fe9ba3aa93358afb80a8595a071dd07 - PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 - quick_actions_ios: 4b07fb49d8d8f3518d7565fbb7a91014067a7d82 - RecaptchaInterop: 11e0b637842dfb48308d242afc3f448062325aba - record_ios: f75fa1d57f840012775c0e93a38a7f3ceea1a374 - screen_brightness_ios: 9953fd7da5bd480f1a93990daeec2eb42d4f3b52 - SDWebImage: e9c98383c7572d713c1a0d7dd2783b10599b9838 - share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a - shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7 - sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0 - SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4 - syncfusion_flutter_pdfviewer: 90dc48305d2e33d4aa20681d1e98ddeda891bc14 - url_launcher_ios: 694010445543906933d732453a59da0a173ae33d - webview_flutter_wkwebview: 1821ceac936eba6f7984d89a9f3bcb4dea99ebb2 - -PODFILE CHECKSUM: 1057d7c44bf0ab9d1ed8a78d57b4ebda5272e992 - -COCOAPODS: 1.16.2 diff --git a/mih_ui/ios/Runner.xcodeproj/project.pbxproj b/mih_ui/ios/Runner.xcodeproj/project.pbxproj deleted file mode 100644 index d8dfea8d..00000000 --- a/mih_ui/ios/Runner.xcodeproj/project.pbxproj +++ /dev/null @@ -1,760 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 54; - objects = { - -/* Begin PBXBuildFile section */ - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 71E3C54FEF20104FD7A5C7E5 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 277EDD110F2042FAAC4E5333 /* Pods_Runner.framework */; }; - 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; - 75DB4569FB42001E83B22FC4 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 486D5A0EDC898EC440394271 /* GoogleService-Info.plist */; }; - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - BB6B9D1B18FA0FA6EA8CED1C /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A290F9A90D1B4F51A7E7DD19 /* Pods_RunnerTests.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 97C146E61CF9000F007C117D /* Project object */; - proxyType = 1; - remoteGlobalIDString = 97C146ED1CF9000F007C117D; - remoteInfo = Runner; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 9705A1C41CF9048500538489 /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 2059B8BD2E7405B800139A50 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; - 209959071B4259A271891D6D /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - 244BDC62FF4364AA78470B4E /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - 277EDD110F2042FAAC4E5333 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 2EC9819F73B85F7509E42F92 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; - 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 486D5A0EDC898EC440394271 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; - 523DAF296A6B559B71F587AF /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; - 52DEBFF4174C303DD5BF01CA /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; - 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; - 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; - 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9885C899E803B0DD96117EDD /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; - A290F9A90D1B4F51A7E7DD19 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 97C146EB1CF9000F007C117D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 71E3C54FEF20104FD7A5C7E5 /* Pods_Runner.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - A772B2AB896E7D4D8271AEA1 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - BB6B9D1B18FA0FA6EA8CED1C /* Pods_RunnerTests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 331C8082294A63A400263BE5 /* RunnerTests */ = { - isa = PBXGroup; - children = ( - 331C807B294A618700263BE5 /* RunnerTests.swift */, - ); - path = RunnerTests; - sourceTree = ""; - }; - 7241FE2A1582C644953298C9 /* Pods */ = { - isa = PBXGroup; - children = ( - 2EC9819F73B85F7509E42F92 /* Pods-Runner.debug.xcconfig */, - 209959071B4259A271891D6D /* Pods-Runner.release.xcconfig */, - 244BDC62FF4364AA78470B4E /* Pods-Runner.profile.xcconfig */, - 523DAF296A6B559B71F587AF /* Pods-RunnerTests.debug.xcconfig */, - 9885C899E803B0DD96117EDD /* Pods-RunnerTests.release.xcconfig */, - 52DEBFF4174C303DD5BF01CA /* Pods-RunnerTests.profile.xcconfig */, - ); - path = Pods; - sourceTree = ""; - }; - 7A61115B6A9E6DA8069C4DD9 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 277EDD110F2042FAAC4E5333 /* Pods_Runner.framework */, - A290F9A90D1B4F51A7E7DD19 /* Pods_RunnerTests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 9740EEB11CF90186004384FC /* Flutter */ = { - isa = PBXGroup; - children = ( - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEB21CF90195004384FC /* Debug.xcconfig */, - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, - 9740EEB31CF90195004384FC /* Generated.xcconfig */, - ); - name = Flutter; - sourceTree = ""; - }; - 97C146E51CF9000F007C117D = { - isa = PBXGroup; - children = ( - 9740EEB11CF90186004384FC /* Flutter */, - 97C146F01CF9000F007C117D /* Runner */, - 97C146EF1CF9000F007C117D /* Products */, - 331C8082294A63A400263BE5 /* RunnerTests */, - 7241FE2A1582C644953298C9 /* Pods */, - 7A61115B6A9E6DA8069C4DD9 /* Frameworks */, - 486D5A0EDC898EC440394271 /* GoogleService-Info.plist */, - ); - sourceTree = ""; - }; - 97C146EF1CF9000F007C117D /* Products */ = { - isa = PBXGroup; - children = ( - 97C146EE1CF9000F007C117D /* Runner.app */, - 331C8081294A63A400263BE5 /* RunnerTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 97C146F01CF9000F007C117D /* Runner */ = { - isa = PBXGroup; - children = ( - 2059B8BD2E7405B800139A50 /* Runner.entitlements */, - 97C146FA1CF9000F007C117D /* Main.storyboard */, - 97C146FD1CF9000F007C117D /* Assets.xcassets */, - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, - 97C147021CF9000F007C117D /* Info.plist */, - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, - 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, - 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, - ); - path = Runner; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 331C8080294A63A400263BE5 /* RunnerTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; - buildPhases = ( - B8A830223C9948D3B05B7F41 /* [CP] Check Pods Manifest.lock */, - 331C807D294A63A400263BE5 /* Sources */, - 331C807F294A63A400263BE5 /* Resources */, - A772B2AB896E7D4D8271AEA1 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 331C8086294A63A400263BE5 /* PBXTargetDependency */, - ); - name = RunnerTests; - productName = RunnerTests; - productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 97C146ED1CF9000F007C117D /* Runner */ = { - isa = PBXNativeTarget; - buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; - buildPhases = ( - 1F30F78507D6132F0739CE81 /* [CP] Check Pods Manifest.lock */, - 9740EEB61CF901F6004384FC /* Run Script */, - 97C146EA1CF9000F007C117D /* Sources */, - 97C146EB1CF9000F007C117D /* Frameworks */, - 97C146EC1CF9000F007C117D /* Resources */, - 9705A1C41CF9048500538489 /* Embed Frameworks */, - 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - CD2265EBFCCA7833EF5BB6D4 /* [CP] Embed Pods Frameworks */, - DB0F489F4E77F5797F339DD3 /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Runner; - productName = Runner; - productReference = 97C146EE1CF9000F007C117D /* Runner.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 97C146E61CF9000F007C117D /* Project object */ = { - isa = PBXProject; - attributes = { - BuildIndependentTargetsInParallel = YES; - LastUpgradeCheck = 1510; - ORGANIZATIONNAME = ""; - TargetAttributes = { - 331C8080294A63A400263BE5 = { - CreatedOnToolsVersion = 14.0; - TestTargetID = 97C146ED1CF9000F007C117D; - }; - 97C146ED1CF9000F007C117D = { - CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 1100; - }; - }; - }; - buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 97C146E51CF9000F007C117D; - productRefGroup = 97C146EF1CF9000F007C117D /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 97C146ED1CF9000F007C117D /* Runner */, - 331C8080294A63A400263BE5 /* RunnerTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 331C807F294A63A400263BE5 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 97C146EC1CF9000F007C117D /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, - 75DB4569FB42001E83B22FC4 /* GoogleService-Info.plist in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 1F30F78507D6132F0739CE81 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", - ); - name = "Thin Binary"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; - }; - 9740EEB61CF901F6004384FC /* Run Script */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Run Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; - }; - B8A830223C9948D3B05B7F41 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - CD2265EBFCCA7833EF5BB6D4 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - DB0F489F4E77F5797F339DD3 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 331C807D294A63A400263BE5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 97C146EA1CF9000F007C117D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 97C146ED1CF9000F007C117D /* Runner */; - targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 97C146FA1CF9000F007C117D /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 97C146FB1CF9000F007C117D /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 97C147001CF9000F007C117D /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 249021D3217E4FDB00AE95B9 /* Profile */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Profile; - }; - 249021D4217E4FDB00AE95B9 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = B88N73P46W; - ENABLE_BITCODE = NO; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64"; - INFOPLIST_FILE = Runner/Info.plist; - INFOPLIST_KEY_CFBundleDisplayName = MIH; - INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = za.co.mzansiinnovationhub.mih; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Profile; - }; - 331C8088294A63A400263BE5 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 523DAF296A6B559B71F587AF /* Pods-RunnerTests.debug.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.patientManager.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; - }; - name = Debug; - }; - 331C8089294A63A400263BE5 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9885C899E803B0DD96117EDD /* Pods-RunnerTests.release.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.patientManager.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; - }; - name = Release; - }; - 331C808A294A63A400263BE5 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 52DEBFF4174C303DD5BF01CA /* Pods-RunnerTests.profile.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.patientManager.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; - }; - name = Profile; - }; - 97C147031CF9000F007C117D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 97C147041CF9000F007C117D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 97C147061CF9000F007C117D /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = B88N73P46W; - ENABLE_BITCODE = NO; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64"; - INFOPLIST_FILE = Runner/Info.plist; - INFOPLIST_KEY_CFBundleDisplayName = MIH; - INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = za.co.mzansiinnovationhub.mih; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Debug; - }; - 97C147071CF9000F007C117D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = B88N73P46W; - ENABLE_BITCODE = NO; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64"; - INFOPLIST_FILE = Runner/Info.plist; - INFOPLIST_KEY_CFBundleDisplayName = MIH; - INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = za.co.mzansiinnovationhub.mih; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 331C8088294A63A400263BE5 /* Debug */, - 331C8089294A63A400263BE5 /* Release */, - 331C808A294A63A400263BE5 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 97C147031CF9000F007C117D /* Debug */, - 97C147041CF9000F007C117D /* Release */, - 249021D3217E4FDB00AE95B9 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 97C147061CF9000F007C117D /* Debug */, - 97C147071CF9000F007C117D /* Release */, - 249021D4217E4FDB00AE95B9 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 97C146E61CF9000F007C117D /* Project object */; -} diff --git a/mih_ui/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/mih_ui/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a6..00000000 --- a/mih_ui/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/mih_ui/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/mih_ui/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/mih_ui/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/mih_ui/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/mih_ui/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings deleted file mode 100644 index f9b0d7c5..00000000 --- a/mih_ui/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ /dev/null @@ -1,8 +0,0 @@ - - - - - PreviewsEnabled - - - diff --git a/mih_ui/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/mih_ui/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme deleted file mode 100644 index e3773d42..00000000 --- a/mih_ui/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mih_ui/ios/Runner.xcworkspace/contents.xcworkspacedata b/mih_ui/ios/Runner.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 21a3cc14..00000000 --- a/mih_ui/ios/Runner.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/mih_ui/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/mih_ui/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/mih_ui/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/mih_ui/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/mih_ui/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings deleted file mode 100644 index f9b0d7c5..00000000 --- a/mih_ui/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ /dev/null @@ -1,8 +0,0 @@ - - - - - PreviewsEnabled - - - diff --git a/mih_ui/ios/Runner/AppDelegate.swift b/mih_ui/ios/Runner/AppDelegate.swift deleted file mode 100644 index b6363034..00000000 --- a/mih_ui/ios/Runner/AppDelegate.swift +++ /dev/null @@ -1,13 +0,0 @@ -import UIKit -import Flutter - -@main -@objc class AppDelegate: FlutterAppDelegate { - override func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? - ) -> Bool { - GeneratedPluginRegistrant.register(with: self) - return super.application(application, didFinishLaunchingWithOptions: launchOptions) - } -} diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/100.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/100.png deleted file mode 100644 index 9883d3cf..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/100.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/102.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/102.png deleted file mode 100644 index 6c66f8d7..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/102.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png deleted file mode 100644 index a99496bd..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png deleted file mode 100644 index fa52572b..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png deleted file mode 100644 index 669572de..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/128.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/128.png deleted file mode 100644 index 11d20a46..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/128.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/144.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/144.png deleted file mode 100644 index 041967ab..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/144.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/152.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/152.png deleted file mode 100644 index 068303ee..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/152.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/16.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/16.png deleted file mode 100644 index 4460a5f0..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/16.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/167.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/167.png deleted file mode 100644 index 38cdc1b2..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/167.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/172.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/172.png deleted file mode 100644 index 9d03869e..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/172.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png deleted file mode 100644 index ccc63265..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/196.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/196.png deleted file mode 100644 index 8344c6a4..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/196.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/20.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/20.png deleted file mode 100644 index 5d9ce1f2..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/20.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/216.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/216.png deleted file mode 100644 index 4c5494ed..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/216.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/256.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/256.png deleted file mode 100644 index e4cf6b7c..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/256.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png deleted file mode 100644 index 0c11a004..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/32.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/32.png deleted file mode 100644 index 255c32c1..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/32.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png deleted file mode 100644 index 29dffaed..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/48.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/48.png deleted file mode 100644 index fe78952e..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/48.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/50.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/50.png deleted file mode 100644 index 5e87d858..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/50.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/512.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/512.png deleted file mode 100644 index d643bbac..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/512.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/55.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/55.png deleted file mode 100644 index e180e8ec..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/55.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png deleted file mode 100644 index 5fe98c37..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png deleted file mode 100644 index f3d35094..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png deleted file mode 100644 index dff4eea2..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/64.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/64.png deleted file mode 100644 index 794e0f1f..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/64.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/66.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/66.png deleted file mode 100644 index 3537eeb9..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/66.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/72.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/72.png deleted file mode 100644 index c2f08f7d..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/72.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/76.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/76.png deleted file mode 100644 index 528fe1f9..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/76.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png deleted file mode 100644 index c440076a..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png deleted file mode 100644 index 09d6e764..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/88.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/88.png deleted file mode 100644 index f156bc3e..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/88.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/92.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/92.png deleted file mode 100644 index b1f803cb..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/92.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index d0d98aa1..00000000 --- a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1 +0,0 @@ -{"images":[{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@3x.png","scale":"3x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@3x.png","scale":"3x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@3x.png","scale":"3x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@1x.png","scale":"1x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@3x.png","scale":"3x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@1x.png","scale":"1x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@1x.png","scale":"1x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@1x.png","scale":"1x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@2x.png","scale":"2x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@1x.png","scale":"1x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@2x.png","scale":"2x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@1x.png","scale":"1x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@2x.png","scale":"2x"},{"size":"83.5x83.5","idiom":"ipad","filename":"Icon-App-83.5x83.5@2x.png","scale":"2x"},{"size":"1024x1024","idiom":"ios-marketing","filename":"Icon-App-1024x1024@1x.png","scale":"1x"}],"info":{"version":1,"author":"xcode"}} \ No newline at end of file diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png deleted file mode 100644 index f0f27c8a..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png deleted file mode 100644 index 6ae27623..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png deleted file mode 100644 index 9018b9e0..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png deleted file mode 100644 index 64136536..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png deleted file mode 100644 index 7a235f79..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png deleted file mode 100644 index 2b6771f8..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png deleted file mode 100644 index a1c7a255..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png deleted file mode 100644 index 9018b9e0..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png deleted file mode 100644 index 4e609d8a..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png deleted file mode 100644 index 3bd904e3..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png deleted file mode 100644 index 40c1ee29..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png deleted file mode 100644 index 2819fbca..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png deleted file mode 100644 index 822fc1c7..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png deleted file mode 100644 index 3a76fe77..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png deleted file mode 100644 index 3bd904e3..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png deleted file mode 100644 index 41091940..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png deleted file mode 100644 index a629ce16..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png deleted file mode 100644 index 51b6e608..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png deleted file mode 100644 index 24325c69..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png deleted file mode 100644 index 8e600112..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png deleted file mode 100644 index efa19e5c..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/BrandingImage.imageset/BrandingImage.png b/mih_ui/ios/Runner/Assets.xcassets/BrandingImage.imageset/BrandingImage.png deleted file mode 100644 index c82d522c..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/BrandingImage.imageset/BrandingImage.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/BrandingImage.imageset/BrandingImage@2x.png b/mih_ui/ios/Runner/Assets.xcassets/BrandingImage.imageset/BrandingImage@2x.png deleted file mode 100644 index 7d34377d..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/BrandingImage.imageset/BrandingImage@2x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/BrandingImage.imageset/BrandingImage@3x.png b/mih_ui/ios/Runner/Assets.xcassets/BrandingImage.imageset/BrandingImage@3x.png deleted file mode 100644 index 844f6592..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/BrandingImage.imageset/BrandingImage@3x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/BrandingImage.imageset/Contents.json b/mih_ui/ios/Runner/Assets.xcassets/BrandingImage.imageset/Contents.json deleted file mode 100644 index 12712275..00000000 --- a/mih_ui/ios/Runner/Assets.xcassets/BrandingImage.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "BrandingImage.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "BrandingImage@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "BrandingImage@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/mih_ui/ios/Runner/Assets.xcassets/Contents.json b/mih_ui/ios/Runner/Assets.xcassets/Contents.json deleted file mode 100644 index 73c00596..00000000 --- a/mih_ui/ios/Runner/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/mih_ui/ios/Runner/Assets.xcassets/LaunchBackground.imageset/Contents.json b/mih_ui/ios/Runner/Assets.xcassets/LaunchBackground.imageset/Contents.json deleted file mode 100644 index 9f447e1b..00000000 --- a/mih_ui/ios/Runner/Assets.xcassets/LaunchBackground.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "background.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/mih_ui/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png b/mih_ui/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png deleted file mode 100644 index 83987bcc..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/mih_ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json deleted file mode 100644 index 00cabce8..00000000 --- a/mih_ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "LaunchImage.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "LaunchImage@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "LaunchImage@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/mih_ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/mih_ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png deleted file mode 100644 index 53e4ced6..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/mih_ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png deleted file mode 100644 index 5071f829..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/mih_ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png deleted file mode 100644 index c198ddbf..00000000 Binary files a/mih_ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png and /dev/null differ diff --git a/mih_ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/mih_ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md deleted file mode 100644 index 89c2725b..00000000 --- a/mih_ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Launch Screen Assets - -You can customize the launch screen with your own desired assets by replacing the image files in this directory. - -You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/mih_ui/ios/Runner/Assets.xcassets/mih_calculator_sc.imageset/Contents.json b/mih_ui/ios/Runner/Assets.xcassets/mih_calculator_sc.imageset/Contents.json deleted file mode 100644 index 76df3ccf..00000000 --- a/mih_ui/ios/Runner/Assets.xcassets/mih_calculator_sc.imageset/Contents.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "images" : [ - { - "filename" : "calculator.svg", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "preserves-vector-representation" : true, - "template-rendering-intent" : "template" - } -} diff --git a/mih_ui/ios/Runner/Assets.xcassets/mih_calculator_sc.imageset/calculator.svg b/mih_ui/ios/Runner/Assets.xcassets/mih_calculator_sc.imageset/calculator.svg deleted file mode 100644 index 89048fe6..00000000 --- a/mih_ui/ios/Runner/Assets.xcassets/mih_calculator_sc.imageset/calculator.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - diff --git a/mih_ui/ios/Runner/Assets.xcassets/mih_home_sc.imageset/Contents.json b/mih_ui/ios/Runner/Assets.xcassets/mih_home_sc.imageset/Contents.json deleted file mode 100644 index 2e65911f..00000000 --- a/mih_ui/ios/Runner/Assets.xcassets/mih_home_sc.imageset/Contents.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "images" : [ - { - "filename" : "mih_logo.svg", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "preserves-vector-representation" : true, - "template-rendering-intent" : "template" - } -} diff --git a/mih_ui/ios/Runner/Assets.xcassets/mih_home_sc.imageset/mih_logo.svg b/mih_ui/ios/Runner/Assets.xcassets/mih_home_sc.imageset/mih_logo.svg deleted file mode 100644 index cfcb5a59..00000000 --- a/mih_ui/ios/Runner/Assets.xcassets/mih_home_sc.imageset/mih_logo.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - diff --git a/mih_ui/ios/Runner/Assets.xcassets/mzansi_ai_sc.imageset/Contents.json b/mih_ui/ios/Runner/Assets.xcassets/mzansi_ai_sc.imageset/Contents.json deleted file mode 100644 index 963ed39d..00000000 --- a/mih_ui/ios/Runner/Assets.xcassets/mzansi_ai_sc.imageset/Contents.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "images" : [ - { - "filename" : "mzansi_ai.svg", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "preserves-vector-representation" : true, - "template-rendering-intent" : "template" - } -} diff --git a/mih_ui/ios/Runner/Assets.xcassets/mzansi_ai_sc.imageset/mzansi_ai.svg b/mih_ui/ios/Runner/Assets.xcassets/mzansi_ai_sc.imageset/mzansi_ai.svg deleted file mode 100644 index cbc854f6..00000000 --- a/mih_ui/ios/Runner/Assets.xcassets/mzansi_ai_sc.imageset/mzansi_ai.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - diff --git a/mih_ui/ios/Runner/Assets.xcassets/mzansi_directory_sc.imageset/Contents.json b/mih_ui/ios/Runner/Assets.xcassets/mzansi_directory_sc.imageset/Contents.json deleted file mode 100644 index 41b7428c..00000000 --- a/mih_ui/ios/Runner/Assets.xcassets/mzansi_directory_sc.imageset/Contents.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "images" : [ - { - "filename" : "mzansi_directory.svg", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "preserves-vector-representation" : true - } -} diff --git a/mih_ui/ios/Runner/Assets.xcassets/mzansi_directory_sc.imageset/mzansi_directory.svg b/mih_ui/ios/Runner/Assets.xcassets/mzansi_directory_sc.imageset/mzansi_directory.svg deleted file mode 100644 index 5f22d7f9..00000000 --- a/mih_ui/ios/Runner/Assets.xcassets/mzansi_directory_sc.imageset/mzansi_directory.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - diff --git a/mih_ui/ios/Runner/Assets.xcassets/mzansi_wallet_sc.imageset/Contents.json b/mih_ui/ios/Runner/Assets.xcassets/mzansi_wallet_sc.imageset/Contents.json deleted file mode 100644 index c5007964..00000000 --- a/mih_ui/ios/Runner/Assets.xcassets/mzansi_wallet_sc.imageset/Contents.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "images" : [ - { - "filename" : "mzansi_wallet.svg", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "preserves-vector-representation" : true, - "template-rendering-intent" : "template" - } -} diff --git a/mih_ui/ios/Runner/Assets.xcassets/mzansi_wallet_sc.imageset/mzansi_wallet.svg b/mih_ui/ios/Runner/Assets.xcassets/mzansi_wallet_sc.imageset/mzansi_wallet.svg deleted file mode 100644 index dae5170d..00000000 --- a/mih_ui/ios/Runner/Assets.xcassets/mzansi_wallet_sc.imageset/mzansi_wallet.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - diff --git a/mih_ui/ios/Runner/Base.lproj/LaunchScreen.storyboard b/mih_ui/ios/Runner/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index 313e34f5..00000000 --- a/mih_ui/ios/Runner/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mih_ui/ios/Runner/Base.lproj/Main.storyboard b/mih_ui/ios/Runner/Base.lproj/Main.storyboard deleted file mode 100644 index f3c28516..00000000 --- a/mih_ui/ios/Runner/Base.lproj/Main.storyboard +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mih_ui/ios/Runner/GoogleService-Info.plist b/mih_ui/ios/Runner/GoogleService-Info.plist deleted file mode 100644 index afac0e1e..00000000 --- a/mih_ui/ios/Runner/GoogleService-Info.plist +++ /dev/null @@ -1,30 +0,0 @@ - - - - - API_KEY - AIzaSyDRqY5I5CXjEtWkUX1YUfKT8IUlln9PUuY - GCM_SENDER_ID - 33677883408 - PLIST_VERSION - 1 - BUNDLE_ID - za.co.mzansiinnovationhub.mih - PROJECT_ID - mzansi-innovation-hub - STORAGE_BUCKET - mzansi-innovation-hub.firebasestorage.app - IS_ADS_ENABLED - - IS_ANALYTICS_ENABLED - - IS_APPINVITE_ENABLED - - IS_GCM_ENABLED - - IS_SIGNIN_ENABLED - - GOOGLE_APP_ID - 1:33677883408:ios:2048dac086428716223295 - - \ No newline at end of file diff --git a/mih_ui/ios/Runner/Info.plist b/mih_ui/ios/Runner/Info.plist deleted file mode 100644 index fa3a51d5..00000000 --- a/mih_ui/ios/Runner/Info.plist +++ /dev/null @@ -1,102 +0,0 @@ - - - - - NSMicrophoneUsageDescription - This app needs access to your microphone to enable voice input for the chat. - NSSpeechRecognitionUsageDescription - This app uses speech recognition to convert your voice messages into text. - ITSAppUsesNonExemptEncryption - - NSMicrophoneUsageDescription - This app needs access to your microphone to enable voice input for the chat. - NSSpeechRecognitionUsageDescription - This app uses speech recognition to convert your voice messages into text. - ITSAppUsesNonExemptEncryption - - SKAdNetworkItems - - - SKAdNetworkIdentifier - v9wttpbfk9.skadnetwork - - - SKAdNetworkIdentifier - n38lu8286q.skadnetwork - - - GADApplicationIdentifier - ca-app-pub-4781880856775334~6935644635 - CADisableMinimumFrameDurationOnPhone - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleDisplayName - MIH - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - mzansi_innovation_hub - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleSignature - ???? - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSApplicationQueriesSchemes - - sms - tel - - LSRequiresIPhoneOS - - LSSupportsOpeningDocumentsInPlace - - NSCameraUsageDescription - This app needs camera access to scan QR codes - NSFaceIDUsageDescription - Why is my app authenticating using face id? - NSLocationWhenInUseUsageDescription - This app needs access to location when open. - NSLocationAlwaysAndWhenInUseUsageDescription - This app needs access to your location at all times to provide [Explain your specific, complete reason here, e.g., real-time tracking, background updates, etc.]. - NSPhotoLibraryUsageDescription - This app needs to access your photo library to select images. - NSDownloadsFolderUsageDescription - This app needs to access your downloads folder to select files from there. - UIApplicationSupportsIndirectInputEvents - - UIBackgroundModes - - fetch - remote-notification - - UIFileSharingEnabled - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UIStatusBarHidden - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/mih_ui/ios/Runner/Runner-Bridging-Header.h b/mih_ui/ios/Runner/Runner-Bridging-Header.h deleted file mode 100644 index 308a2a56..00000000 --- a/mih_ui/ios/Runner/Runner-Bridging-Header.h +++ /dev/null @@ -1 +0,0 @@ -#import "GeneratedPluginRegistrant.h" diff --git a/mih_ui/ios/Runner/Runner.entitlements b/mih_ui/ios/Runner/Runner.entitlements deleted file mode 100644 index 5cf09c4f..00000000 --- a/mih_ui/ios/Runner/Runner.entitlements +++ /dev/null @@ -1,10 +0,0 @@ - - - - - com.apple.developer.associated-domains - - applinks:app.mzansi-innovation-hub.co.za - - - diff --git a/mih_ui/ios/RunnerTests/RunnerTests.swift b/mih_ui/ios/RunnerTests/RunnerTests.swift deleted file mode 100644 index 86a7c3b1..00000000 --- a/mih_ui/ios/RunnerTests/RunnerTests.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Flutter -import UIKit -import XCTest - -class RunnerTests: XCTestCase { - - func testExample() { - // If you add code to the Runner application, consider adding tests here. - // See https://developer.apple.com/documentation/xctest for more information about using XCTest. - } - -} diff --git a/mih_ui/lib/firebase_options.dart b/mih_ui/lib/firebase_options.dart deleted file mode 100644 index b606fb0e..00000000 --- a/mih_ui/lib/firebase_options.dart +++ /dev/null @@ -1,89 +0,0 @@ -// File generated by FlutterFire CLI. -// ignore_for_file: type=lint -import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; -import 'package:flutter/foundation.dart' - show defaultTargetPlatform, kIsWeb, TargetPlatform; - -/// Default [FirebaseOptions] for use with your Firebase apps. -/// -/// Example: -/// ```dart -/// import 'firebase_options.dart'; -/// // ... -/// await Firebase.initializeApp( -/// options: DefaultFirebaseOptions.currentPlatform, -/// ); -/// ``` -class DefaultFirebaseOptions { - static FirebaseOptions get currentPlatform { - if (kIsWeb) { - return web; - } - switch (defaultTargetPlatform) { - case TargetPlatform.android: - return android; - case TargetPlatform.iOS: - return ios; - case TargetPlatform.macOS: - return macos; - case TargetPlatform.windows: - return windows; - case TargetPlatform.linux: - return web; - // throw UnsupportedError( - // 'DefaultFirebaseOptions have not been configured for linux - ' - // 'you can reconfigure this by running the FlutterFire CLI again.', - // ); - default: - throw UnsupportedError( - 'DefaultFirebaseOptions are not supported for this platform.', - ); - } - } - - static const FirebaseOptions web = FirebaseOptions( - apiKey: 'AIzaSyDN-f4sJ4n_fyvrLR193_IIkTsccRVUQxw', - appId: '1:33677883408:web:47b8021df7fcacd2223295', - messagingSenderId: '33677883408', - projectId: 'mzansi-innovation-hub', - authDomain: 'mzansi-innovation-hub.firebaseapp.com', - storageBucket: 'mzansi-innovation-hub.firebasestorage.app', - measurementId: 'G-Y3B5E3HCJY', - ); - - static const FirebaseOptions android = FirebaseOptions( - apiKey: 'AIzaSyBUkjWdu9YcgiF-e9TC5hoiEoCjPyjA5hU', - appId: '1:33677883408:android:ebd8565991c56257223295', - messagingSenderId: '33677883408', - projectId: 'mzansi-innovation-hub', - storageBucket: 'mzansi-innovation-hub.firebasestorage.app', - ); - - static const FirebaseOptions ios = FirebaseOptions( - apiKey: 'AIzaSyDRqY5I5CXjEtWkUX1YUfKT8IUlln9PUuY', - appId: '1:33677883408:ios:2048dac086428716223295', - messagingSenderId: '33677883408', - projectId: 'mzansi-innovation-hub', - storageBucket: 'mzansi-innovation-hub.firebasestorage.app', - iosBundleId: 'za.co.mzansiinnovationhub.mih', - ); - - static const FirebaseOptions macos = FirebaseOptions( - apiKey: 'AIzaSyDRqY5I5CXjEtWkUX1YUfKT8IUlln9PUuY', - appId: '1:33677883408:ios:e2db11a42fc3452e223295', - messagingSenderId: '33677883408', - projectId: 'mzansi-innovation-hub', - storageBucket: 'mzansi-innovation-hub.firebasestorage.app', - iosBundleId: 'com.example.patientManager', - ); - - static const FirebaseOptions windows = FirebaseOptions( - apiKey: 'AIzaSyDN-f4sJ4n_fyvrLR193_IIkTsccRVUQxw', - appId: '1:33677883408:web:e08becaef3261c59223295', - messagingSenderId: '33677883408', - projectId: 'mzansi-innovation-hub', - authDomain: 'mzansi-innovation-hub.firebaseapp.com', - storageBucket: 'mzansi-innovation-hub.firebasestorage.app', - measurementId: 'G-FKKENBX8TT', - ); -} diff --git a/mih_ui/lib/main.dart b/mih_ui/lib/main.dart deleted file mode 100644 index edf94144..00000000 --- a/mih_ui/lib/main.dart +++ /dev/null @@ -1,185 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/mih_providers/about_mih_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_access_controlls_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_authentication_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_banner_ad_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_calculator_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_file_viewer_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_mine_sweeper_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_ai_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_wallet_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:provider/provider.dart'; -import 'package:quick_actions/quick_actions.dart'; -import 'package:upgrader/upgrader.dart'; -import 'mih_config/mih_env.dart'; -import 'mih_config/mih_theme.dart'; - -class MzansiInnovationHub extends StatefulWidget { - final GoRouter router; - const MzansiInnovationHub({ - super.key, - required this.router, - }); - - @override - State createState() => _MzansiInnovationHubState(); - - // ignore: library_private_types_in_public_api - static _MzansiInnovationHubState? of(BuildContext context) => - context.findAncestorStateOfType<_MzansiInnovationHubState>(); -} - -class _MzansiInnovationHubState extends State { - late MihTheme theme; - final QuickActions quickActions = QuickActions(); - String shortcut = 'no action set'; - - void _initializeQuickActions() { - quickActions.initialize((String shortcutType) { - setState(() { - shortcut = shortcutType; - }); - if (shortcutType == 'mihHome') { - KenLogger.success("ShortCut: mihHome"); - widget.router.goNamed("mihHome"); - } - if (shortcutType == 'mzansiDirectory') { - KenLogger.success("ShortCut: mzansiDirectory"); - widget.router.goNamed("mzansiDirectory"); - } - if (shortcutType == 'mzansiWallet') { - KenLogger.success("ShortCut: mzansiWallet"); - widget.router.goNamed("mzansiWallet"); - } - if (shortcutType == 'mzansiAi') { - KenLogger.success("ShortCut: mzansiAi"); - widget.router.goNamed("mzansiAi"); - } - if (shortcutType == 'mihCalculator') { - KenLogger.success("ShortCut: mihCalculator"); - widget.router.goNamed("mihCalculator"); - } - }); - // Set the quick actions - quickActions.setShortcutItems([ - const ShortcutItem( - type: 'mzansiDirectory', - localizedTitle: 'Mzansi Directory', - icon: 'mzansi_directory_sc', - ), - const ShortcutItem( - type: 'mzansiWallet', - localizedTitle: 'Mzansi Wallet', - icon: 'mzansi_wallet_sc', - ), - const ShortcutItem( - type: 'mzansiAi', - localizedTitle: 'Mzansi AI', - icon: 'mzansi_ai_sc', - ), - const ShortcutItem( - type: 'mihCalculator', - localizedTitle: 'MIH Calc', - icon: 'mih_calculator_sc', - ), - ]).then((void _) { - setState(() { - if (shortcut == 'no action set') { - shortcut = 'mih_home_sc'; - } - }); - }); - } - - @override - void initState() { - super.initState(); - if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) { - _initializeQuickActions(); - } - theme = MihTheme(); - theme.mode = "Dark"; - theme.platform = Theme.of(context).platform; - } - - @override - Widget build(BuildContext context) { - double width = MediaQuery.sizeOf(context).width; - theme.setScreenType(width); - return MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (context) => MihAuthenticationProvider(), - ), - ChangeNotifierProvider( - create: (context) => MzansiProfileProvider(), - ), - ChangeNotifierProvider( - create: (context) => MzansiWalletProvider(), - ), - ChangeNotifierProvider( - create: (context) => MzansiAiProvider(), - ), - ChangeNotifierProvider( - create: (context) => MzansiDirectoryProvider(), - ), - ChangeNotifierProvider( - create: (context) => MihBannerAdProvider(), - ), - ChangeNotifierProvider( - create: (context) => MihCalculatorProvider(), - ), - ChangeNotifierProvider( - create: (context) => MihAccessControllsProvider(), - ), - ChangeNotifierProvider( - create: (context) => MihCalendarProvider(), - ), - ChangeNotifierProvider( - create: (context) => AboutMihProvider(), - ), - ChangeNotifierProvider( - create: (context) => MihMineSweeperProvider(), - ), - ChangeNotifierProvider( - create: (context) => PatientManagerProvider(), - ), - ChangeNotifierProvider( - create: (context) => MihFileViewerProvider(), - ), - ], - child: MaterialApp.router( - title: AppEnviroment.getEnv() == "Dev" - ? "Dev | MIH App: Mzansi Innovation Hub" - : "MIH App: Mzansi Innovation Hub", - themeMode: ThemeMode.dark, - theme: theme.getThemeData(), - darkTheme: theme.getThemeData(), - debugShowCheckedModeBanner: false, - routerConfig: widget.router, - builder: (context, child) { - if (child == null) { - return const Scaffold( - body: Center( - child: CircularProgressIndicator(), - ), - ); - } - return UpgradeAlert( - navigatorKey: widget.router.routerDelegate.navigatorKey, - child: child, - ); - }, - ), - ); - } -} diff --git a/mih_ui/lib/main_dev.dart b/mih_ui/lib/main_dev.dart deleted file mode 100644 index e1c394dd..00000000 --- a/mih_ui/lib/main_dev.dart +++ /dev/null @@ -1,51 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:flutter_native_splash/flutter_native_splash.dart'; -import 'package:flutter_web_plugins/url_strategy.dart' - if (dart.library.html) 'package:flutter_web_plugins/url_strategy.dart'; -import 'package:go_router/go_router.dart'; -import 'package:google_mobile_ads/google_mobile_ads.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_go_router.dart'; -import 'package:pwa_install/pwa_install.dart'; -import 'mih_config/mih_env.dart'; -import 'package:supertokens_flutter/supertokens.dart'; - -void main() async { - WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized(); - FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding); - await AppEnviroment.setupEnv(Enviroment.dev); - SuperTokens.init( - apiDomain: AppEnviroment.baseApiUrl, - apiBasePath: "/auth", - ); - // await Firebase.initializeApp( - // // options: DefaultFirebaseOptions.currentPlatform, - // options: (Platform.isLinux) - // ? DefaultFirebaseOptions.web // Forces Linux to use the Web config - // : DefaultFirebaseOptions.currentPlatform, - // ); - if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) { - const List testDeviceIds = ['733d4c68-9b54-453a-9622-2df407310f40']; - MobileAds.instance.updateRequestConfiguration( - RequestConfiguration( - testDeviceIds: testDeviceIds, - ), - ); - MobileAds.instance.initialize(); - } else { - usePathUrlStrategy(); - } - PWAInstall().setup(installCallback: () { - debugPrint('APP INSTALLED!'); - }); - final GoRouter appRouter = MihGoRouter().mihRouter; - await dotenv.load(fileName: ".env"); - FlutterNativeSplash.remove(); - runApp(MzansiInnovationHub( - router: appRouter, - )); -} diff --git a/mih_ui/lib/main_prod.dart b/mih_ui/lib/main_prod.dart deleted file mode 100644 index b7026b50..00000000 --- a/mih_ui/lib/main_prod.dart +++ /dev/null @@ -1,42 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:flutter_native_splash/flutter_native_splash.dart'; -import 'package:flutter_web_plugins/url_strategy.dart' - if (dart.library.html) 'package:flutter_web_plugins/url_strategy.dart'; -import 'package:go_router/go_router.dart'; -import 'package:google_mobile_ads/google_mobile_ads.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_go_router.dart'; -import 'package:pwa_install/pwa_install.dart'; -import 'mih_config/mih_env.dart'; -import 'package:supertokens_flutter/supertokens.dart'; - -void main() async { - WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized(); - FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding); - await AppEnviroment.setupEnv(Enviroment.prod); - SuperTokens.init( - apiDomain: AppEnviroment.baseApiUrl, - apiBasePath: "/auth", - ); - // await Firebase.initializeApp( - // options: DefaultFirebaseOptions.currentPlatform, - // ); - if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) { - MobileAds.instance.initialize(); - } else { - usePathUrlStrategy(); - } - PWAInstall().setup(installCallback: () { - debugPrint('APP INSTALLED!'); - }); - final GoRouter appRouter = MihGoRouter().mihRouter; - await dotenv.load(fileName: ".env"); - FlutterNativeSplash.remove(); - runApp(MzansiInnovationHub( - router: appRouter, - )); -} diff --git a/mih_ui/lib/mih_config/mih_colors.dart b/mih_ui/lib/mih_config/mih_colors.dart deleted file mode 100644 index 8422230e..00000000 --- a/mih_ui/lib/mih_config/mih_colors.dart +++ /dev/null @@ -1,140 +0,0 @@ -import 'package:flutter/material.dart'; - -class MihColors { - bool women4Change = true; - static Color getPrimaryColor(bool darkMode) { - if (darkMode == true) { - return const Color(0XFF3A4454); // Original - // return const Color(0XFF6641b2); // Women4change - } else { - return const Color(0XFFbedcfe); // Original - // return const Color(0xFFE0D1FF); // Women4change - } - } - - static Color getSecondaryColor(bool darkMode) { - if (darkMode == true) { - return const Color(0XFFbedcfe); // Original - // return const Color(0xFFE0D1FF); // Women4change - } else { - return const Color(0XFF3A4454); // Original - // return const Color(0XFF6641b2); // Women4change - } - } - - static Color getSecondaryInvertedColor(bool darkMode) { - if (darkMode == true) { - return const Color(0XFF412301); // Original - // return const Color(0XFF1f2e00); // Women4change - } else { - return const Color(0XFFc5bbab); // Original - // return const Color(0XFF99be4d); // Women4change - } - } - - static Color getHighlightColor(bool darkMode) { - if (darkMode == true) { - return const Color(0XFF9bc7fa); - // return const Color(0xFFC8AFFB); // Women4change - } else { - return const Color(0XFF354866); - // return const Color(0XFF6641b2); // Women4change - } - } - - static Color getGreyColor(bool darkMode) { - if (darkMode == true) { - return const Color(0XFFc8c8c8); - } else { - return const Color(0XFF747474); - } - } - - static Color getGreenColor(bool darkMode) { - if (darkMode == true) { - return const Color(0xff8ae290); - } else { - return const Color(0xFF41B349); - } - } - - static Color getRedColor(bool darkMode) { - if (darkMode == true) { - return const Color(0xffD87E8B); - } else { - return const Color(0xffbb3d4f); - } - } - - static Color getPinkColor(bool darkMode) { - if (darkMode == true) { - return const Color(0xffdaa2e9); - } else { - // Add a different shade of pink for light mode - return const Color(0xffdaa2e9); - } - } - - static Color getOrangeColor(bool darkMode) { - if (darkMode == true) { - return const Color(0xffd69d7d); - } else { - // Add a different shade of pink for light mode - return const Color(0xFFBD7145); - } - } - - static Color getYellowColor(bool darkMode) { - if (darkMode == true) { - return const Color(0xfff4e467); - } else { - // Add a different shade of pink for light mode - return const Color(0xffd4af37); - } - } - - static Color getBluishPurpleColor(bool darkMode) { - if (darkMode == true) { - return const Color(0xff6e7dcc); - } else { - // Add a different shade of pink for light mode - return const Color(0xFF5567C0); - } - } - - static Color getPurpleColor(bool darkMode) { - if (darkMode == true) { - return const Color(0xffb682e7); - } else { - // Add a different shade of pink for light mode - return const Color(0xFF9857D4); - } - } - - static Color getGoldColor(bool darkMode) { - if (darkMode == true) { - return const Color(0xFFD4AF37); - } else { - // Add a different shade of pink for light mode - return const Color(0xffFFD700); - } - } - - static Color getSilverColor(bool darkMode) { - if (darkMode == true) { - return const Color(0xffC0C0C0); - } else { - // Add a different shade of pink for light mode - return const Color(0xFFA6A6A6); - } - } - - static Color getBronze(bool darkMode) { - if (darkMode == true) { - return const Color(0xffB1560F); - } else { - // Add a different shade of pink for light mode - return const Color(0xFFCD7F32); - } - } -} diff --git a/mih_ui/lib/mih_config/mih_env.dart b/mih_ui/lib/mih_config/mih_env.dart deleted file mode 100644 index 168e33a0..00000000 --- a/mih_ui/lib/mih_config/mih_env.dart +++ /dev/null @@ -1,89 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/foundation.dart'; - -enum Enviroment { dev, prod } - -// -abstract class AppEnviroment { - static late String baseAppUrl; - static late String baseApiUrl; - static late String baseAiUrl; - static late String baseFileUrl; - static late String bannerAdUnitId; - static late String whatsappAccessToken; - static late String fingerPrintPluginKey; - static late Enviroment _enviroment; - static Enviroment get enviroment => _enviroment; - static setupEnv(Enviroment env) { - _enviroment = env; - switch (env) { - case Enviroment.dev: - { - if (kIsWeb) { - //================= Web Dev Urls ================= - baseAppUrl = "http://localhost:80"; - baseApiUrl = "http://localhost:8080"; - baseFileUrl = "http://localhost:9000"; - baseAiUrl = "http://localhost:11434"; - bannerAdUnitId = 'ca-app-pub-3940256099942544/2435281174'; // IOS ID - break; - } else if (Platform.isIOS || Platform.isLinux) { - //================= Web Dev Urls ================= - baseAppUrl = "http://localhost:80"; - baseApiUrl = "http://localhost:8080"; - baseFileUrl = "http://localhost:9000"; - baseAiUrl = "http://localhost:11434"; - bannerAdUnitId = 'ca-app-pub-3940256099942544/2435281174'; // IOS ID - break; - } else if (Platform.isAndroid) { - //================= Android Dev Urls ================= - baseAppUrl = "http://10.0.2.2:80"; - baseApiUrl = "http://10.0.2.2:8080"; - baseFileUrl = "http://10.0.2.2:9000"; - baseAiUrl = "http://10.0.2.2:11434"; - bannerAdUnitId = 'ca-app-pub-3940256099942544/9214589741'; - } - } - case Enviroment.prod: - { - baseAppUrl = "https://app.mzansi-innovation-hub.co.za"; - baseApiUrl = "https://api.mzansi-innovation-hub.co.za"; - baseFileUrl = "https://minio.mzansi-innovation-hub.co.za"; - baseAiUrl = "https://ai.mzansi-innovation-hub.co.za"; - if (kIsWeb) { - // No banner ads on web, or use a placeholder/specific web ad unit - bannerAdUnitId = ''; // Or a specific web ad unit ID if you have one - } else if (Platform.isAndroid) { - bannerAdUnitId = - 'ca-app-pub-4781880856775334/8868663088'; // Android - } else if (Platform.isIOS) { - // Use Platform.isIOS for clarity - bannerAdUnitId = 'ca-app-pub-4781880856775334/6640324682'; // iOS - } else { - // Fallback for other platforms if necessary - bannerAdUnitId = ''; - } - // bannerAdUnitId = Platform.isAndroid - // ? 'ca-app-pub-4781880856775334/8868663088' // Android - // : 'ca-app-pub-4781880856775334/6640324682'; // iOS - //fingerPrintPluginKey = 'h5X7a5j14iUZCobI1ZeX'; - break; - } - } - } - - static String getEnv() { - //_enviroment = env; - switch (_enviroment) { - case Enviroment.dev: - { - return "Dev"; - } - case Enviroment.prod: - { - return "Prod"; - } - } - } -} diff --git a/mih_ui/lib/mih_config/mih_go_router.dart b/mih_ui/lib/mih_config/mih_go_router.dart deleted file mode 100644 index 545d04d3..00000000 --- a/mih_ui/lib/mih_config/mih_go_router.dart +++ /dev/null @@ -1,375 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mih_file_viewer/components/mih_print_prevew.dart'; -import 'package:mzansi_innovation_hub/mih_objects/arguments.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/Example/package_test.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/about_mih/about_mih.dart'; -import 'package:mzansi_innovation_hub/mih_packages/access_review/mih_access.dart'; -import 'package:mzansi_innovation_hub/mih_packages/calculator/mih_calculator.dart'; -import 'package:mzansi_innovation_hub/mih_packages/calendar/mzansi_calendar.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/mih_auth_forgot_password.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/mih_auth_password_reset.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/mih_authentication.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mih_file_viewer/mih_fle_viewer.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mih_home/mih_home.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mih_home/mih_route_error.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/mih_mine_sweeper.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_ai/mzansi_ai.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/mzansi_directory.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/busines_profile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/mzansi_business_profile_view.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/mzansi_set_up_business_profile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/personal_profile/mzansi_profile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/personal_profile/mzansi_profile_view.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_barcode_scanner.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/mih_wallet.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_manager/pat_manager.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/patient_profile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/patient_set_up.dart'; -import 'package:provider/provider.dart'; -import 'package:supertokens_flutter/supertokens.dart'; - -class MihGoRouterPaths { - // External - static const String resetPassword = '/auth/reset-password'; - static const String privacyPolicyExternal = '/privacy-policy'; - static const String termsOfServiceExternal = '/terms-of-service'; - - // Internal - // static const String authCheck = '/'; - static const String mihAuthentication = '/mih-authentication'; - static const String mihHome = '/'; - static const String notifications = '/notifications'; - static const String forgotPassword = '/mih-authentication/forgot-password'; - static const String aboutMih = '/about'; - static const String mzansiProfileManage = '/mzansi-profile'; - static const String mzansiProfileView = '/mzansi-profile/view'; - static const String businessProfileSetup = '/business-profile/set-up'; - static const String businessProfileManage = '/business-profile/manage'; - static const String businessProfileView = '/business-profile/view'; - static const String patientProfile = '/patient-profile'; - static const String patientProfileSetup = '/patient-profile/set-up'; - static const String mzansiWallet = '/mzansi-wallet'; - static const String mzansiDirectory = '/mzansi-directory'; - static const String mihAccess = '/mih-access'; - static const String calendar = '/calendar'; - static const String appointments = '/appointments'; - static const String patientManager = '/patient-manager'; - static const String patientManagerPatient = '/patient-manager/patient'; - static const String fileViewer = '/file-veiwer'; - static const String printPreview = '/file-veiwer/print-preview'; - static const String barcodeScanner = '/scanner'; - static const String calculator = '/calculator'; - static const String mzansiAi = '/mzansi-ai'; - static const String mihMineSweeper = '/mih-minesweeper'; - static const String packageDevTest = '/package-dev'; -} - -class MihGoRouter { - final GoRouter mihRouter = GoRouter( - initialLocation: MihGoRouterPaths.mihHome, - redirect: (BuildContext context, GoRouterState state) async { - final bool isUserSignedIn = await SuperTokens.doesSessionExist(); - final unauthenticatedPaths = [ - MihGoRouterPaths.mihAuthentication, - MihGoRouterPaths.forgotPassword, - MihGoRouterPaths.resetPassword, - MihGoRouterPaths.aboutMih, - MihGoRouterPaths.businessProfileView, - ]; - KenLogger.success( - "Redirect Check: ${state.fullPath}, isUserSignedIn: $isUserSignedIn"); - if (!isUserSignedIn && !unauthenticatedPaths.contains(state.fullPath)) { - return MihGoRouterPaths.mihAuthentication; - } - if (isUserSignedIn && - unauthenticatedPaths.contains(state.fullPath) && - state.fullPath != MihGoRouterPaths.aboutMih && - state.fullPath != MihGoRouterPaths.businessProfileView) { - return MihGoRouterPaths.mihHome; - } - return null; // Stay on current route - }, - routes: [ - // ========================== MIH Auth ================================== - GoRoute( - name: "mihAuthentication", - path: MihGoRouterPaths.mihAuthentication, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: mihAuthentication"); - return MihAuthentication(); - }, - ), - GoRoute( - name: "forgotPassword", - path: MihGoRouterPaths.forgotPassword, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: forgotPassword"); - return const MihAuthForgotPassword(); - }, - ), - GoRoute( - name: "resetPassword", - path: MihGoRouterPaths.resetPassword, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: resetPassword"); - String? token = state.uri.queryParameters['token']; - KenLogger.success("token: $token"); - if (token == null) { - WidgetsBinding.instance.addPostFrameCallback((_) { - context.go(MihGoRouterPaths.mihHome); - }); - return const SizedBox.shrink(); - } - return MihAuthPasswordReset(token: token); - }, - ), - // ========================== MIH Home ================================== - GoRoute( - name: "mihHome", - path: MihGoRouterPaths.mihHome, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: mihHome"); - return MihHome( - key: UniqueKey(), - ); - }, - ), - // ========================== About MIH ================================== - GoRoute( - name: "aboutMih", - path: MihGoRouterPaths.aboutMih, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: aboutMih"); - return AboutMih(); - }, - ), - // ========================== Mzansi Profile Personal ================================== - GoRoute( - name: "mzansiProfileManage", - path: MihGoRouterPaths.mzansiProfileManage, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: mzansiProfileManage"); - return MzansiProfile(); - }, - ), - GoRoute( - name: "mzansiProfileView", - path: MihGoRouterPaths.mzansiProfileView, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: mzansiProfileView"); - MzansiDirectoryProvider directoryProvider = - context.read(); - if (directoryProvider.selectedUser == null) { - WidgetsBinding.instance.addPostFrameCallback((_) { - context.go(MihGoRouterPaths.mihHome); - }); - return const SizedBox.shrink(); - } - return MzansiProfileView(); - }, - ), - // ========================== Mzansi Profile Business ================================== - GoRoute( - name: "businessProfileManage", - path: MihGoRouterPaths.businessProfileManage, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: businessProfileManage"); - return BusinesProfile(); - }, - ), - GoRoute( - name: "businessProfileView", - path: MihGoRouterPaths.businessProfileView, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: businessProfileView"); - String? businessId = state.uri.queryParameters['business_id']; - KenLogger.success("businessId: $businessId"); - MzansiDirectoryProvider directoryProvider = - context.read(); - if (directoryProvider.selectedBusiness == null && - businessId == null) { - WidgetsBinding.instance.addPostFrameCallback((_) { - context.go(MihGoRouterPaths.mihHome); - }); - return const SizedBox.shrink(); - } - return MzansiBusinessProfileView( - businessId: businessId, - fromMzansiDirectory: businessId == null, - ); - }, - ), - GoRoute( - name: "businessProfileSetup", - path: MihGoRouterPaths.businessProfileSetup, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: businessProfileSetup"); - return MzansiSetUpBusinessProfile(); - }, - ), - // ========================== MIH Calculator ================================== - GoRoute( - name: "mihCalculator", - path: MihGoRouterPaths.calculator, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: mihCalculator"); - return MIHCalculator(); - }, - ), - // ========================== MIH Calculator ================================== - GoRoute( - name: "mihCalendar", - path: MihGoRouterPaths.calendar, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: mihCalendar"); - return MzansiCalendar(); - }, - ), - // ========================== Mzansi AI ================================== - GoRoute( - name: "mzansiAi", - path: MihGoRouterPaths.mzansiAi, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: mzansiAi"); - return MzansiAi(); - }, - ), - // ========================== Mzansi Wallet ================================== - GoRoute( - name: "mzansiWallet", - path: MihGoRouterPaths.mzansiWallet, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: mzansiWallet"); - return MihWallet(); - }, - ), - GoRoute( - name: "barcodeScanner", - path: MihGoRouterPaths.barcodeScanner, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: barcodeScanner"); - final TextEditingController? args = - state.extra as TextEditingController?; - if (args == null) { - WidgetsBinding.instance.addPostFrameCallback((_) { - context.go(MihGoRouterPaths.mihHome); - }); - return const SizedBox.shrink(); - } - return MihBarcodeScanner(cardNumberController: args); - }, - ), - // ========================== Test Package ================================== - GoRoute( - name: "testPackage", - path: MihGoRouterPaths.packageDevTest, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: testPackage"); - return PackageTest(); - }, - ), - // ========================== MIH Access Controls ================================== - GoRoute( - name: "mihAccess", - path: MihGoRouterPaths.mihAccess, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: mihAccess"); - return MihAccess(); - }, - ), - // ========================== Patient Profile ================================== - GoRoute( - name: "patientProfile", - path: MihGoRouterPaths.patientProfile, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: patientProfile"); - return PatientProfile(); - }, - ), - GoRoute( - name: "patientProfileSetup", - path: MihGoRouterPaths.patientProfileSetup, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: patientProfileSetup"); - return PatientSetUp(); - }, - ), - GoRoute( - name: "patientManager", - path: MihGoRouterPaths.patientManager, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: patientManager"); - return PatManager(); - }, - ), - GoRoute( - name: "patientManagerPatient", - path: MihGoRouterPaths.patientManagerPatient, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: patientManagerPatient"); - return PatientProfile(); - }, - ), - // ========================== Mzansi Directory ================================== - GoRoute( - name: "mzansiDirectory", - path: MihGoRouterPaths.mzansiDirectory, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: mzansiDirectory"); - return MzansiDirectory(); - }, - ), - // ========================== End ================================== - GoRoute( - name: "fileViewer", - path: MihGoRouterPaths.fileViewer, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: fileViewer"); - return MihFleViewer(); - }, - ), - GoRoute( - name: "printPreview", - path: MihGoRouterPaths.printPreview, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: printPreview"); - final PrintPreviewArguments? args = - state.extra as PrintPreviewArguments?; - if (args == null) { - WidgetsBinding.instance.addPostFrameCallback((_) { - context.go(MihGoRouterPaths.mihHome); - }); - return const SizedBox.shrink(); - } - return MIHPrintPreview(arguments: args); - }, - ), - // ========================== MIH Minesweeper ================================== - GoRoute( - name: "mihMinesweeper", - path: MihGoRouterPaths.mihMineSweeper, - builder: (BuildContext context, GoRouterState state) { - KenLogger.success("MihGoRouter: mihMineSweeper"); - return MihMineSweeper(); - }, - ), - // ========================== End ================================== -// GoRoute( -// name: "notifications", -// path: MihGoRouterPaths.notifications, -// builder: (BuildContext context, GoRouterState state) { -// final NotificationArguments? args = state.extra as NotificationArguments?; -// return MIHNotificationMessage(arguments: args!); -// }, -// ), - ], - // 3. Error handling with `errorBuilder` and `redirect` - errorBuilder: (BuildContext context, GoRouterState state) { - KenLogger.error('Invalid Route'); - return const MihRouteError(); - }, - ); -} diff --git a/mih_ui/lib/mih_config/mih_theme.dart b/mih_ui/lib/mih_config/mih_theme.dart deleted file mode 100644 index 1e4870cc..00000000 --- a/mih_ui/lib/mih_config/mih_theme.dart +++ /dev/null @@ -1,151 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import "package:universal_html/html.dart" as html; - -class MihTheme { - late String mode; - late String screenType; - late AssetImage loading; - late String loadingAssetText; - late TargetPlatform platform; - bool kIsWeb = const bool.fromEnvironment('dart.library.js_util'); - String latestVersion = "1.2.6"; - MihTheme() { - mode = "Dark"; - } - - ThemeData getData(bool bool) { - return ThemeData( - fontFamily: 'Segoe UI', - scaffoldBackgroundColor: MihColors.getPrimaryColor(mode == "Dark"), - colorScheme: ColorScheme( - brightness: getBritness(), - primary: MihColors.getSecondaryColor(mode == "Dark"), - onPrimary: MihColors.getPrimaryColor(mode == "Dark"), - secondary: MihColors.getPrimaryColor(mode == "Dark"), - onSecondary: MihColors.getSecondaryColor(mode == "Dark"), - error: MihColors.getRedColor(mode == "Dark"), - onError: MihColors.getPrimaryColor(mode == "Dark"), - surface: MihColors.getPrimaryColor(mode == "Dark"), - onSurface: MihColors.getSecondaryColor(mode == "Dark"), - ), - datePickerTheme: DatePickerThemeData( - backgroundColor: MihColors.getPrimaryColor(mode == "Dark"), - headerBackgroundColor: MihColors.getSecondaryColor(mode == "Dark"), - headerForegroundColor: MihColors.getPrimaryColor(mode == "Dark"), - ), - appBarTheme: AppBarTheme( - color: MihColors.getSecondaryColor(mode == "Dark"), - foregroundColor: MihColors.getPrimaryColor(mode == "Dark"), - titleTextStyle: TextStyle( - color: MihColors.getPrimaryColor(mode == "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - floatingActionButtonTheme: FloatingActionButtonThemeData( - backgroundColor: MihColors.getSecondaryColor(mode == "Dark"), - foregroundColor: MihColors.getPrimaryColor(mode == "Dark"), - extendedTextStyle: - TextStyle(color: MihColors.getPrimaryColor(mode == "Dark")), - ), - drawerTheme: DrawerThemeData( - backgroundColor: MihColors.getPrimaryColor(mode == "Dark"), - ), - textSelectionTheme: TextSelectionThemeData( - cursorColor: MihColors.getPrimaryColor(mode == "Dark"), - selectionColor: - MihColors.getPrimaryColor(mode == "Dark").withOpacity(0.25), - selectionHandleColor: MihColors.getPrimaryColor(mode == "Dark"), - ), - tooltipTheme: TooltipThemeData( - decoration: BoxDecoration( - color: MihColors.getSecondaryColor(mode == "Dark"), - borderRadius: BorderRadius.circular(6), - border: Border.all( - width: 1.0, - color: MihColors.getPrimaryColor(mode == "Dark"), - ), - boxShadow: [ - BoxShadow( - color: - MihColors.getPrimaryColor(mode == "Dark").withOpacity(0.18), - blurRadius: 6, - offset: const Offset(0, 2), - ), - ], - ), - textStyle: TextStyle( - color: MihColors.getPrimaryColor(mode == "Dark"), - fontSize: 13, - height: 1.2, - ), - waitDuration: const Duration(milliseconds: 500), - showDuration: const Duration(seconds: 3), - preferBelow: true, - verticalOffset: 24, - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), - triggerMode: TooltipTriggerMode.longPress, - ), - ); - } - - String getPlatform() { - if (kIsWeb) { - return "Web"; - } else if (!kIsWeb) { - if (platform == TargetPlatform.android) { - return "Android"; - } else if (platform == TargetPlatform.iOS) { - return "iOS"; - } else if (platform == TargetPlatform.linux) { - return "Linux"; - } else if (platform == TargetPlatform.macOS) { - return "macOS"; - } else if (platform == TargetPlatform.windows) { - return "Windows"; - } - } - return "Other"; - } - - bool isPwa() { - return html.window.matchMedia('(display-mode: standalone)').matches; - } - - void setMode(String m) { - mode; - } - - String getLatestVersion() { - return latestVersion; - } - - ThemeData getThemeData() { - return getData(mode == "Dark"); - } - - ThemeData darkMode() { - return getData(mode == "Dark"); - } - - ThemeData lightMode() { - return getData(mode == "Dark"); - } - - Brightness getBritness() { - if (mode == "Dark") { - return Brightness.dark; - } else { - return Brightness.light; - } - } - - void setScreenType(double width) { - if (width <= 800) { - screenType = "mobile"; - } else { - screenType = "desktop"; - } - } -} diff --git a/mih_ui/lib/mih_objects/access_request.dart b/mih_ui/lib/mih_objects/access_request.dart deleted file mode 100644 index 849cb08b..00000000 --- a/mih_ui/lib/mih_objects/access_request.dart +++ /dev/null @@ -1,55 +0,0 @@ -class AccessRequest { - final int idpatient_queue; - final String business_id; - final String app_id; - final String date_time; - final String access; - final String revoke_date; - final String Name; - final String type; - final String logo_path; - final String contact_no; - - const AccessRequest({ - required this.idpatient_queue, - required this.business_id, - required this.app_id, - required this.date_time, - required this.access, - required this.revoke_date, - required this.Name, - required this.type, - required this.logo_path, - required this.contact_no, - }); - - factory AccessRequest.fromJson(Map json) { - return switch (json) { - { - "idpatient_queue": int idpatient_queue, - 'business_id': String business_id, - 'app_id': String app_id, - 'date_time': String date_time, - 'access': String access, - 'revoke_date': String revoke_date, - 'Name': String Name, - 'type': String type, - 'logo_path': String logo_path, - 'contact_no': String contact_no, - } => - AccessRequest( - idpatient_queue: idpatient_queue, - business_id: business_id, - app_id: app_id, - date_time: date_time, - access: access, - revoke_date: revoke_date, - Name: Name, - type: type, - logo_path: logo_path, - contact_no: contact_no, - ), - _ => throw const FormatException('Failed to load album.'), - }; - } -} diff --git a/mih_ui/lib/mih_objects/app_user.dart b/mih_ui/lib/mih_objects/app_user.dart deleted file mode 100644 index 94a00a7d..00000000 --- a/mih_ui/lib/mih_objects/app_user.dart +++ /dev/null @@ -1,38 +0,0 @@ -// ignore: file_names -class AppUser { - final int idUser; - final String email; - final String fname; - final String lname; - final String type; - final String app_id; - final String username; - final String pro_pic_path; - final String purpose; - - const AppUser( - this.idUser, - this.email, - this.fname, - this.lname, - this.type, - this.app_id, - this.username, - this.pro_pic_path, - this.purpose, - ); - - factory AppUser.fromJson(dynamic json) { - return AppUser( - json['idUser'], - json['email'], - json['fname'], - json['lname'], - json['type'], - json['app_id'], - json['username'], - json['pro_pic_path'], - json['purpose'], - ); - } -} diff --git a/mih_ui/lib/mih_objects/appointment.dart b/mih_ui/lib/mih_objects/appointment.dart deleted file mode 100644 index 92942996..00000000 --- a/mih_ui/lib/mih_objects/appointment.dart +++ /dev/null @@ -1,39 +0,0 @@ -class Appointment { - final int idappointments; - final String app_id; - final String business_id; - final String date_time; - final String title; - final String description; - - const Appointment({ - required this.idappointments, - required this.app_id, - required this.business_id, - required this.date_time, - required this.title, - required this.description, - }); - - factory Appointment.fromJson(Map json) { - return switch (json) { - { - "idappointments": int idappointments, - 'app_id': String app_id, - 'business_id': String business_id, - 'date_time': String date_time, - 'title': String title, - 'description': String description, - } => - Appointment( - idappointments: idappointments, - app_id: app_id, - business_id: business_id, - date_time: date_time, - title: title, - description: description, - ), - _ => throw const FormatException('Failed to load album.'), - }; - } -} diff --git a/mih_ui/lib/mih_objects/arguments.dart b/mih_ui/lib/mih_objects/arguments.dart deleted file mode 100644 index 6bb378cd..00000000 --- a/mih_ui/lib/mih_objects/arguments.dart +++ /dev/null @@ -1,263 +0,0 @@ -import 'dart:typed_data'; - -import 'package:flutter/material.dart'; -import 'app_user.dart'; -import 'business.dart'; -import 'business_user.dart'; -import 'notification.dart'; -import 'patients.dart'; - -class NotificationArguments { - final String title; - final String body; - final void Function()? onTap; - - NotificationArguments( - this.title, - this.body, - this.onTap, - ); -} - -class BusinessArguments { - final AppUser signedInUser; - final BusinessUser? businessUser; - final Business? business; - - BusinessArguments( - this.signedInUser, - this.businessUser, - this.business, - ); -} - -class BusinessViewArguments { - final Business business; - final String? startUpSearch; - - BusinessViewArguments( - this.business, - this.startUpSearch, - ); -} - -class HomeArguments { - final AppUser signedInUser; - final BusinessUser? businessUser; - final Business? business; - final Patient? patient; - final List notifi; - final String profilePicUrl; - - HomeArguments( - this.signedInUser, - this.businessUser, - this.business, - this.patient, - this.notifi, - this.profilePicUrl, - ); -} - -class AppProfileUpdateArguments { - final AppUser signedInUser; - final ImageProvider? propicFile; - - AppProfileUpdateArguments(this.signedInUser, this.propicFile); -} - -class FileViewArguments { - final String link; - final String path; - - FileViewArguments( - this.link, - this.path, - ); -} - -class PrintPreviewArguments { - final Uint8List pdfData; - final String fileName; - - PrintPreviewArguments( - this.pdfData, - this.fileName, - ); -} - -class PatientViewArguments { - final AppUser signedInUser; - final Patient? selectedPatient; - final BusinessUser? businessUser; - final Business? business; - final String type; - - PatientViewArguments( - this.signedInUser, - this.selectedPatient, - this.businessUser, - this.business, - this.type, - ); -} - -class PatientEditArguments { - final AppUser signedInUser; - final Patient selectedPatient; - - PatientEditArguments( - this.signedInUser, - this.selectedPatient, - ); -} - -class ClaimStatementGenerationArguments { - final String document_type; - final String patient_app_id; - final String patient_full_name; - final String patient_id_no; - final String has_med_aid; - final String med_aid_no; - final String med_aid_code; - final String med_aid_name; - final String med_aid_scheme; - final String busName; - final String busAddr; - final String busNo; - final String busEmail; - final String provider_name; - final String practice_no; - final String vat_no; - final String service_date; - final String service_desc; - final String service_desc_option; - final String procedure_name; - final String procedure_additional_info; - final String icd10_code; - final String amount; - final String pre_auth_no; - final String logo_path; - final String sig_path; - - ClaimStatementGenerationArguments( - this.document_type, - this.patient_app_id, - this.patient_full_name, - this.patient_id_no, - this.has_med_aid, - this.med_aid_no, - this.med_aid_code, - this.med_aid_name, - this.med_aid_scheme, - this.busName, - this.busAddr, - this.busNo, - this.busEmail, - this.provider_name, - this.practice_no, - this.vat_no, - this.service_date, - this.service_desc, - this.service_desc_option, - this.procedure_name, - this.procedure_additional_info, - this.icd10_code, - this.amount, - this.pre_auth_no, - this.logo_path, - this.sig_path, - ); -} - -class AuthArguments { - final bool personalSelected; - final bool firstBoot; - - AuthArguments( - this.personalSelected, - this.firstBoot, - ); -} - -class CalendarArguments { - final AppUser signedInUser; - final bool personalSelected; - final Business? business; - final BusinessUser? businessUser; - - CalendarArguments( - this.signedInUser, - this.personalSelected, - this.business, - this.businessUser, - ); -} - -class PatManagerArguments { - final AppUser signedInUser; - final bool personalSelected; - final Business? business; - final BusinessUser? businessUser; - - PatManagerArguments( - this.signedInUser, - this.personalSelected, - this.business, - this.businessUser, - ); -} - -class WalletArguments { - final AppUser signedInUser; - final int index; - - WalletArguments( - this.signedInUser, - this.index, - ); -} - -class MzansiAiArguments { - final AppUser signedInUser; - final String? startUpQuestion; - final bool personalSelected; - - MzansiAiArguments( - this.signedInUser, - this.startUpQuestion, - this.personalSelected, - ); -} - -class MzansiDirectoryArguments { - final bool personalSearch; - final int? packageIndex; - final String? startSearchText; - - MzansiDirectoryArguments({ - required this.personalSearch, - this.packageIndex, - required this.startSearchText, - }); -} - -class AboutArguments { - final bool personalSelected; - final int? packageIndex; - - AboutArguments( - this.personalSelected, - this.packageIndex, - ); -} - -class TestArguments { - final AppUser user; - final Business? business; - - TestArguments( - this.user, - this.business, - ); -} diff --git a/mih_ui/lib/mih_objects/bookmarked_business.dart b/mih_ui/lib/mih_objects/bookmarked_business.dart deleted file mode 100644 index 9674858e..00000000 --- a/mih_ui/lib/mih_objects/bookmarked_business.dart +++ /dev/null @@ -1,35 +0,0 @@ -class BookmarkedBusiness { - final int idbookmarked_businesses; - final String app_id; - final String business_id; - final String business_name; - final String created_date; - - BookmarkedBusiness({ - required this.idbookmarked_businesses, - required this.app_id, - required this.business_id, - required this.business_name, - required this.created_date, - }); - factory BookmarkedBusiness.fromJson(Map json) { - return switch (json) { - { - "idbookmarked_businesses": int idbookmarked_businesses, - "app_id": String app_id, - "business_id": String business_id, - "business_name": String business_name, - "created_date": String created_date, - } => - BookmarkedBusiness( - idbookmarked_businesses: idbookmarked_businesses, - app_id: app_id, - business_id: business_id, - business_name: business_name, - created_date: created_date, - ), - _ => throw const FormatException( - 'Failed to load bookmarked business objects'), - }; - } -} diff --git a/mih_ui/lib/mih_objects/business.dart b/mih_ui/lib/mih_objects/business.dart deleted file mode 100644 index 2939ba24..00000000 --- a/mih_ui/lib/mih_objects/business.dart +++ /dev/null @@ -1,56 +0,0 @@ -// ignore: file_names -class Business { - final String business_id; - final String Name; - final String type; - final String registration_no; - final String logo_name; - final String logo_path; - final String contact_no; - final String bus_email; - final String app_id; - final String gps_location; - final String practice_no; - final String vat_no; - final String website; - final String rating; - final String mission_vision; - - const Business( - this.business_id, - this.Name, - this.type, - this.registration_no, - this.logo_name, - this.logo_path, - this.contact_no, - this.bus_email, - this.app_id, - this.gps_location, - this.practice_no, - this.vat_no, - this.website, - this.rating, - this.mission_vision, - ); - - factory Business.fromJson(dynamic json) { - return Business( - json['business_id'], - json['Name'], - json['type'], - json['registration_no'], - json['logo_name'], - json['logo_path'], - json['contact_no'], - json['bus_email'], - json['app_id'], - json['gps_location'], - json['practice_no'], - json['vat_no'], - json['website'], - json['rating'], - json['mission_vision'], - ); - } -} diff --git a/mih_ui/lib/mih_objects/business_employee.dart b/mih_ui/lib/mih_objects/business_employee.dart deleted file mode 100644 index 5e3caf0e..00000000 --- a/mih_ui/lib/mih_objects/business_employee.dart +++ /dev/null @@ -1,35 +0,0 @@ -// ignore: file_names -class BusinessEmployee { - final String business_id; - final String app_id; - final String title; - final String access; - final String fname; - final String lname; - final String email; - final String username; - - const BusinessEmployee( - this.business_id, - this.app_id, - this.title, - this.access, - this.fname, - this.lname, - this.email, - this.username, - ); - - factory BusinessEmployee.fromJson(dynamic json) { - return BusinessEmployee( - json['business_id'], - json['app_id'], - json['title'], - json['access'], - json['fname'], - json['lname'], - json['email'], - json['username'], - ); - } -} diff --git a/mih_ui/lib/mih_objects/business_review.dart b/mih_ui/lib/mih_objects/business_review.dart deleted file mode 100644 index d4fe583c..00000000 --- a/mih_ui/lib/mih_objects/business_review.dart +++ /dev/null @@ -1,47 +0,0 @@ -class BusinessReview { - final int idbusiness_ratings; - final String app_id; - final String business_id; - final String rating_title; - final String rating_description; - final String rating_score; - final String date_time; - final String reviewer; - - BusinessReview({ - required this.idbusiness_ratings, - required this.app_id, - required this.business_id, - required this.rating_title, - required this.rating_description, - required this.rating_score, - required this.date_time, - required this.reviewer, - }); - factory BusinessReview.fromJson(Map json) { - return switch (json) { - { - "idbusiness_ratings": int idbusiness_ratings, - "app_id": String app_id, - "business_id": String business_id, - "rating_title": String rating_title, - "rating_description": String rating_description, - "rating_score": String rating_score, - "date_time": String date_time, - "reviewer": String reviewer, - } => - BusinessReview( - idbusiness_ratings: idbusiness_ratings, - app_id: app_id, - business_id: business_id, - rating_title: rating_title, - rating_description: rating_description, - rating_score: rating_score, - date_time: date_time, - reviewer: reviewer, - ), - _ => - throw const FormatException('Failed to load Business Review objects'), - }; - } -} diff --git a/mih_ui/lib/mih_objects/business_user.dart b/mih_ui/lib/mih_objects/business_user.dart deleted file mode 100644 index b87641fa..00000000 --- a/mih_ui/lib/mih_objects/business_user.dart +++ /dev/null @@ -1,32 +0,0 @@ -// ignore: file_names -class BusinessUser { - final int idbusiness_users; - final String business_id; - final String app_id; - final String signature; - final String sig_path; - final String title; - final String access; - - const BusinessUser( - this.idbusiness_users, - this.business_id, - this.app_id, - this.signature, - this.sig_path, - this.title, - this.access, - ); - - factory BusinessUser.fromJson(dynamic json) { - return BusinessUser( - json['idbusiness_users'], - json['business_id'], - json['app_id'], - json['signature'], - json['sig_path'], - json['title'], - json['access'], - ); - } -} diff --git a/mih_ui/lib/mih_objects/claim_statement_file.dart b/mih_ui/lib/mih_objects/claim_statement_file.dart deleted file mode 100644 index 6845b53b..00000000 --- a/mih_ui/lib/mih_objects/claim_statement_file.dart +++ /dev/null @@ -1,40 +0,0 @@ -class ClaimStatementFile { - final int idclaim_statement_file; - final String app_id; - final String business_id; - final String insert_date; - final String file_path; - final String file_name; - - const ClaimStatementFile({ - required this.idclaim_statement_file, - required this.app_id, - required this.business_id, - required this.insert_date, - required this.file_path, - required this.file_name, - }); - - factory ClaimStatementFile.fromJson(Map json) { - return switch (json) { - { - "idclaim_statement_file": int idclaim_statement_file, - 'app_id': String app_id, - 'business_id': String business_id, - 'insert_date': String insert_date, - 'file_path': String file_path, - 'file_name': String file_name, - } => - ClaimStatementFile( - idclaim_statement_file: idclaim_statement_file, - app_id: app_id, - business_id: business_id, - insert_date: insert_date, - file_path: file_path, - file_name: file_name, - ), - _ => - throw const FormatException('Failed to load Claim Statement Object.'), - }; - } -} diff --git a/mih_ui/lib/mih_objects/currency.dart b/mih_ui/lib/mih_objects/currency.dart deleted file mode 100644 index d87eacf7..00000000 --- a/mih_ui/lib/mih_objects/currency.dart +++ /dev/null @@ -1,23 +0,0 @@ -class Currency { - final String code; - final String name; - - const Currency({ - required this.code, - required this.name, - }); - - factory Currency.fromJson(Map json) { - return switch (json) { - { - "code": String code, - 'name': String name, - } => - Currency( - code: code, - name: name, - ), - _ => throw const FormatException('Failed to load Currency object.'), - }; - } -} diff --git a/mih_ui/lib/mih_objects/email_and_patient_screen_args.dart b/mih_ui/lib/mih_objects/email_and_patient_screen_args.dart deleted file mode 100644 index a24e9d4a..00000000 --- a/mih_ui/lib/mih_objects/email_and_patient_screen_args.dart +++ /dev/null @@ -1,6 +0,0 @@ -class EditScreenArguments { - final String useremail; - final String selectedPatient; - - EditScreenArguments({required this.useremail, required this.selectedPatient}); -} diff --git a/mih_ui/lib/mih_objects/files.dart b/mih_ui/lib/mih_objects/files.dart deleted file mode 100644 index 1f73fbea..00000000 --- a/mih_ui/lib/mih_objects/files.dart +++ /dev/null @@ -1,25 +0,0 @@ -class PFile { - final int idpatient_files; - final String file_path; - final String file_name; - final String insert_date; - final String app_id; - - const PFile( - this.idpatient_files, - this.file_path, - this.file_name, - this.insert_date, - this.app_id, - ); - - factory PFile.fromJson(dynamic json) { - return PFile( - json['idpatient_files'], - json['file_path'], - json['file_name'], - json['insert_date'], - json['app_id'], - ); - } -} diff --git a/mih_ui/lib/mih_objects/icd10_code.dart.dart b/mih_ui/lib/mih_objects/icd10_code.dart.dart deleted file mode 100644 index dc675090..00000000 --- a/mih_ui/lib/mih_objects/icd10_code.dart.dart +++ /dev/null @@ -1,23 +0,0 @@ -class ICD10Code { - final String icd10; - final String description; - - const ICD10Code({ - required this.icd10, - required this.description, - }); - - factory ICD10Code.fromJson(Map json) { - return switch (json) { - { - "icd10": String icd10, - 'description': String description, - } => - ICD10Code( - icd10: icd10, - description: description, - ), - _ => throw const FormatException('Failed to load icd10 code object.'), - }; - } -} diff --git a/mih_ui/lib/mih_objects/loyalty_card.dart b/mih_ui/lib/mih_objects/loyalty_card.dart deleted file mode 100644 index 5926ae2d..00000000 --- a/mih_ui/lib/mih_objects/loyalty_card.dart +++ /dev/null @@ -1,43 +0,0 @@ -class MIHLoyaltyCard { - final int idloyalty_cards; - final String app_id; - final String shop_name; - final String card_number; - final String favourite; - final int priority_index; - final String nickname; - - const MIHLoyaltyCard({ - required this.idloyalty_cards, - required this.app_id, - required this.shop_name, - required this.card_number, - required this.favourite, - required this.priority_index, - required this.nickname, - }); - - factory MIHLoyaltyCard.fromJson(Map json) { - return switch (json) { - { - "idloyalty_cards": int idloyalty_cards, - "app_id": String app_id, - "shop_name": String shop_name, - "card_number": String card_number, - "favourite": String favourite, - "priority_index": int priority_index, - "nickname": String nickname, - } => - MIHLoyaltyCard( - idloyalty_cards: idloyalty_cards, - app_id: app_id, - shop_name: shop_name, - card_number: card_number, - favourite: favourite, - priority_index: priority_index, - nickname: nickname, - ), - _ => throw const FormatException('Failed to load loyalty card objects'), - }; - } -} diff --git a/mih_ui/lib/mih_objects/medicine.dart b/mih_ui/lib/mih_objects/medicine.dart deleted file mode 100644 index 489fd6c4..00000000 --- a/mih_ui/lib/mih_objects/medicine.dart +++ /dev/null @@ -1,19 +0,0 @@ -class Medicine { - final String name; - final String unit; - final String form; - - const Medicine( - this.name, - this.unit, - this.form, - ); - - factory Medicine.fromJson(dynamic json) { - return Medicine( - json['name'], - json['unit'], - json['dosage form'], - ); - } -} diff --git a/mih_ui/lib/mih_objects/minesweeper_player_score.dart b/mih_ui/lib/mih_objects/minesweeper_player_score.dart deleted file mode 100644 index 9a1dad89..00000000 --- a/mih_ui/lib/mih_objects/minesweeper_player_score.dart +++ /dev/null @@ -1,42 +0,0 @@ -class MinesweeperPlayerScore { - String app_id; - String username; - String proPicUrl; - String difficulty; - String game_time; - double game_score; - DateTime played_date; - - MinesweeperPlayerScore({ - required this.app_id, - required this.username, - required this.proPicUrl, - required this.difficulty, - required this.game_time, - required this.game_score, - required this.played_date, - }); - - factory MinesweeperPlayerScore.fromJson(Map json) { - return MinesweeperPlayerScore( - app_id: json['app_id'], - username: json['username'], - proPicUrl: json['proPicUrl'], - difficulty: json['difficulty'], - game_time: json['game_time'], - game_score: json['game_score'], - played_date: DateTime.parse(json['played_date']), - ); - } - - Map toJson() { - return { - 'app_id': app_id, - 'username': username, - 'proPicUrl': proPicUrl, - 'difficulty': difficulty, - 'game_time': game_score, - 'played_date': played_date.toIso8601String(), - }; - } -} diff --git a/mih_ui/lib/mih_objects/notes.dart b/mih_ui/lib/mih_objects/notes.dart deleted file mode 100644 index 30233eab..00000000 --- a/mih_ui/lib/mih_objects/notes.dart +++ /dev/null @@ -1,43 +0,0 @@ -class Note { - final int idpatient_notes; - final String note_name; - final String note_text; - final String insert_date; - final String doc_office; - final String doctor; - final String app_id; - - const Note({ - required this.idpatient_notes, - required this.note_name, - required this.note_text, - required this.insert_date, - required this.doc_office, - required this.doctor, - required this.app_id, - }); - - factory Note.fromJson(Map json) { - return switch (json) { - { - "idpatient_notes": int idpatient_notes, - "note_name": String note_name, - "note_text": String note_text, - "insert_date": String insert_date, - "doc_office": String doc_office, - "doctor": String doctor, - "app_id": String app_id, - } => - Note( - idpatient_notes: idpatient_notes, - note_name: note_name, - note_text: note_text, - insert_date: insert_date, - doc_office: doc_office, - doctor: doctor, - app_id: app_id, - ), - _ => throw const FormatException('Failed to load album.'), - }; - } -} diff --git a/mih_ui/lib/mih_objects/notification.dart b/mih_ui/lib/mih_objects/notification.dart deleted file mode 100644 index 0806ba6c..00000000 --- a/mih_ui/lib/mih_objects/notification.dart +++ /dev/null @@ -1,43 +0,0 @@ -class MIHNotification { - final int idnotifications; - final String app_id; - final String notification_message; - final String notification_read; - final String action_path; - final String insert_date; - final String notification_type; - - const MIHNotification({ - required this.idnotifications, - required this.app_id, - required this.notification_message, - required this.notification_read, - required this.action_path, - required this.insert_date, - required this.notification_type, - }); - - factory MIHNotification.fromJson(Map json) { - return switch (json) { - { - "idnotifications": int idnotifications, - "app_id": String app_id, - "notification_message": String notification_message, - "notification_read": String notification_read, - "action_path": String action_path, - "insert_date": String insert_date, - "notification_type": String notification_type, - } => - MIHNotification( - idnotifications: idnotifications, - app_id: app_id, - notification_message: notification_message, - notification_read: notification_read, - action_path: action_path, - insert_date: insert_date, - notification_type: notification_type, - ), - _ => throw const FormatException('Failed to load Notifications.'), - }; - } -} diff --git a/mih_ui/lib/mih_objects/patient_access.dart b/mih_ui/lib/mih_objects/patient_access.dart deleted file mode 100644 index e0eb7ecb..00000000 --- a/mih_ui/lib/mih_objects/patient_access.dart +++ /dev/null @@ -1,63 +0,0 @@ -class PatientAccess { - final String business_id; - final String business_name; - final String app_id; - final String fname; - final String lname; - final String id_no; - final String type; - final String status; - final String approved_by; - final String approved_on; - final String requested_by; - final String requested_on; - - const PatientAccess({ - required this.business_id, - required this.business_name, - required this.app_id, - required this.fname, - required this.lname, - required this.id_no, - required this.type, - required this.status, - required this.approved_by, - required this.approved_on, - required this.requested_by, - required this.requested_on, - }); - - factory PatientAccess.fromJson(Map json) { - return switch (json) { - { - "business_id": String business_id, - 'business_name': String business_name, - 'app_id': String app_id, - 'fname': String fname, - 'lname': String lname, - 'id_no': String id_no, - 'type': String type, - 'status': String status, - 'approved_by': String approved_by, - 'approved_on': String approved_on, - 'requested_by': String requested_by, - 'requested_on': String requested_on, - } => - PatientAccess( - business_id: business_id, - business_name: business_name, - app_id: app_id, - fname: fname, - lname: lname, - id_no: id_no, - type: type, - status: status, - approved_by: approved_by, - approved_on: approved_on, - requested_by: requested_by, - requested_on: requested_on, - ), - _ => throw const FormatException('Failed to load Patient Access List.'), - }; - } -} diff --git a/mih_ui/lib/mih_objects/patient_queue.dart b/mih_ui/lib/mih_objects/patient_queue.dart deleted file mode 100644 index e8c5e0c9..00000000 --- a/mih_ui/lib/mih_objects/patient_queue.dart +++ /dev/null @@ -1,51 +0,0 @@ -class PatientQueue { - final int idpatient_queue; - final String business_id; - final String app_id; - final String date_time; - final String id_no; - final String first_name; - final String last_name; - final String medical_aid_no; - final String business_name; - - const PatientQueue({ - required this.idpatient_queue, - required this.business_id, - required this.app_id, - required this.date_time, - required this.id_no, - required this.first_name, - required this.last_name, - required this.medical_aid_no, - required this.business_name, - }); - - factory PatientQueue.fromJson(Map json) { - return switch (json) { - { - "idpatient_queue": int idpatient_queue, - 'business_id': String business_id, - 'app_id': String app_id, - 'date_time': String date_time, - 'id_no': String id_no, - 'first_name': String first_name, - 'last_name': String last_name, - 'medical_aid_no': String medical_aid_no, - 'business_name': String business_name, - } => - PatientQueue( - idpatient_queue: idpatient_queue, - business_id: business_id, - app_id: app_id, - date_time: date_time, - id_no: id_no, - first_name: first_name, - last_name: last_name, - medical_aid_no: medical_aid_no, - business_name: business_name, - ), - _ => throw const FormatException('Failed to load album.'), - }; - } -} diff --git a/mih_ui/lib/mih_objects/patients.dart b/mih_ui/lib/mih_objects/patients.dart deleted file mode 100644 index 9654194f..00000000 --- a/mih_ui/lib/mih_objects/patients.dart +++ /dev/null @@ -1,75 +0,0 @@ -class Patient { - final int idpatients; - final String id_no; - final String first_name; - final String last_name; - final String email; - final String cell_no; - final String medical_aid; - final String medical_aid_name; - final String medical_aid_no; - final String medical_aid_main_member; - final String medical_aid_code; - final String medical_aid_scheme; - final String address; - final String app_id; - - const Patient({ - required this.idpatients, - required this.id_no, - required this.first_name, - required this.last_name, - required this.email, - required this.cell_no, - required this.medical_aid, - required this.medical_aid_name, - required this.medical_aid_no, - required this.medical_aid_main_member, - required this.medical_aid_code, - required this.medical_aid_scheme, - required this.address, - required this.app_id, - }); - - factory Patient.fromJson(Map json) { - return switch (json) { - { - "idpatients": int idpatients, - 'id_no': String id_no, - 'first_name': String first_name, - 'last_name': String last_name, - 'email': String email, - 'cell_no': String cell_no, - 'medical_aid': String medical_aid, - 'medical_aid_name': String medical_aid_name, - 'medical_aid_no': String medical_aid_no, - 'medical_aid_main_member': String medical_aid_main_member, - 'medical_aid_code': String medical_aid_code, - 'medical_aid_scheme': String medical_aid_scheme, - 'address': String address, - 'app_id': String app_id, - } => - Patient( - idpatients: idpatients, - id_no: id_no, - first_name: first_name, - last_name: last_name, - email: email, - cell_no: cell_no, - medical_aid: medical_aid, - medical_aid_name: medical_aid_name, - medical_aid_no: medical_aid_no, - medical_aid_main_member: medical_aid_main_member, - medical_aid_code: medical_aid_code, - medical_aid_scheme: medical_aid_scheme, - address: address, - app_id: app_id, - ), - _ => throw const FormatException('Failed to load album.'), - }; - } - - String getIDNum() { - return id_no; - } -} diff --git a/mih_ui/lib/mih_objects/perscription.dart b/mih_ui/lib/mih_objects/perscription.dart deleted file mode 100644 index 795c484b..00000000 --- a/mih_ui/lib/mih_objects/perscription.dart +++ /dev/null @@ -1,65 +0,0 @@ -class Perscription { - final String name; - final String unit; - final String form; - final String fullForm; - final String quantity; - final String dosage; - final String times; - final String days; - final String repeats; - - const Perscription({ - required this.name, - required this.unit, - required this.form, - required this.fullForm, - required this.quantity, - required this.dosage, - required this.times, - required this.days, - required this.repeats, - }); - - factory Perscription.fromJson(Map json) { - return switch (json) { - { - "name": String name, - 'unit': String unit, - 'form': String form, - 'fullForm': String fullForm, - 'quantity': String quantity, - 'dosage': String dosage, - 'times': String times, - 'days': String days, - 'repeats': String repeats, - } => - Perscription( - name: name, - unit: unit, - form: form, - fullForm: fullForm, - quantity: quantity, - dosage: dosage, - times: times, - days: days, - repeats: repeats, - ), - _ => throw const FormatException('Failed to load album.'), - }; - } - - Map toJson() { - return { - "name": name, - 'unit': unit, - 'form': form, - 'fullForm': fullForm, - 'quantity': quantity, - 'dosage': dosage, - 'times': times, - 'days': days, - 'repeats': repeats, - }; - } -} diff --git a/mih_ui/lib/mih_objects/profile_link.dart b/mih_ui/lib/mih_objects/profile_link.dart deleted file mode 100644 index 103a1e72..00000000 --- a/mih_ui/lib/mih_objects/profile_link.dart +++ /dev/null @@ -1,35 +0,0 @@ -class ProfileLink { - final int idprofile_links; - final String app_id; - final String business_id; - final String destination; - final String web_link; - - const ProfileLink({ - required this.idprofile_links, - required this.app_id, - required this.business_id, - required this.destination, - required this.web_link, - }); - - factory ProfileLink.fromJson(Map json) { - return ProfileLink( - idprofile_links: json['idprofile_links'], - app_id: json['app_id'], - business_id: json['business_id'], - destination: json['destination'], - web_link: json['web_link'], - ); - } - - Map toJson() { - return { - 'idprofile_links': idprofile_links, - 'app_id': app_id, - 'business_id': business_id, - 'destination': destination, - 'web_link': web_link, - }; - } -} diff --git a/mih_ui/lib/mih_objects/session_st.dart b/mih_ui/lib/mih_objects/session_st.dart deleted file mode 100644 index f7157fad..00000000 --- a/mih_ui/lib/mih_objects/session_st.dart +++ /dev/null @@ -1,23 +0,0 @@ -class SessionST { - final String status; - final bool exists; - - const SessionST({ - required this.status, - required this.exists, - }); - - factory SessionST.fromJson(Map json) { - return switch (json) { - { - 'status': String status, - 'exists': bool exists, - } => - SessionST( - status: status, - exists: exists, - ), - _ => throw const FormatException('Failed to load SessionST.'), - }; - } -} diff --git a/mih_ui/lib/mih_objects/user_consent.dart b/mih_ui/lib/mih_objects/user_consent.dart deleted file mode 100644 index f62ebb06..00000000 --- a/mih_ui/lib/mih_objects/user_consent.dart +++ /dev/null @@ -1,29 +0,0 @@ -class UserConsent { - String app_id; - DateTime privacy_policy_accepted; - DateTime terms_of_services_accepted; - - UserConsent({ - required this.app_id, - required this.privacy_policy_accepted, - required this.terms_of_services_accepted, - }); - - factory UserConsent.fromJson(Map json) { - return UserConsent( - app_id: json['app_id'], - privacy_policy_accepted: DateTime.parse(json['privacy_policy_accepted']), - terms_of_services_accepted: - DateTime.parse(json['terms_of_services_accepted']), - ); - } - - Map toJson() { - return { - 'app_id': app_id, - 'privacy_policy_accepted': privacy_policy_accepted.toIso8601String(), - 'terms_of_services_accepted': - terms_of_services_accepted.toIso8601String(), - }; - } -} diff --git a/mih_ui/lib/mih_package_components/Example/package_test.dart b/mih_ui/lib/mih_package_components/Example/package_test.dart deleted file mode 100644 index f69cb639..00000000 --- a/mih_ui/lib/mih_package_components/Example/package_test.dart +++ /dev/null @@ -1,154 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tools/package_tool_three.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tools/package_tool_zero.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tools/package_tool_one.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tools/package_tool_two.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_data_helper_services.dart'; -import 'package:provider/provider.dart'; - -class PackageTest extends StatefulWidget { - const PackageTest({ - super.key, - }); - - @override - State createState() => _PackageTestState(); -} - -class _PackageTestState extends State { - int _selcetedIndex = 0; - bool _isLoadingInitialData = true; - - Future _loadInitialData() async { - setState(() { - _isLoadingInitialData = true; - }); - MzansiProfileProvider mzansiProfileProvider = - context.read(); - if (mzansiProfileProvider.user == null) { - await MihDataHelperServices().loadUserDataWithBusinessesData( - mzansiProfileProvider, - ); - } - setState(() { - _isLoadingInitialData = false; - }); - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - context.goNamed( - 'mihHome', - extra: true, - ); - FocusScope.of(context).unfocus(); - // Navigator.of(context).pop(); - // Navigator.of(context).popAndPushNamed( - // '/', - // arguments: AuthArguments(true, false), - // ); - }, - ); - } - - MihPackageTools getTools() { - Map temp = Map(); - temp[const Icon(Icons.link)] = () { - setState(() { - _selcetedIndex = 0; - }); - }; - temp[const Icon(Icons.warning)] = () { - setState(() { - _selcetedIndex = 1; - }); - }; - temp[const Icon(Icons.inbox)] = () { - setState(() { - _selcetedIndex = 2; - }); - }; - temp[const Icon(Icons.outbond)] = () { - setState(() { - _selcetedIndex = 3; - }); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: _selcetedIndex, - ); - } - - void showAlert() { - MihAlertServices().inputErrorAlert(context); - } - - List getToolBody() { - MzansiProfileProvider profileProvider = - context.read(); - List toolBodies = [ - const PackageToolThree(), - const PackageToolZero(), - PackageToolOne( - user: profileProvider.user!, - business: profileProvider.business, - ), - const PackageToolTwo(), - ]; - return toolBodies; - } - - List getToolTitle() { - List toolTitles = [ - "Tool Zero", - "Tool One", - "Tool Two", - ]; - return toolTitles; - } - - @override - void initState() { - super.initState(); - _loadInitialData(); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: - (BuildContext context, MzansiProfileProvider value, Widget? child) { - if (_isLoadingInitialData) { - return Scaffold( - body: Center( - child: Mihloadingcircle(), - ), - ); - } - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: getToolTitle(), - selectedbodyIndex: _selcetedIndex, - onIndexChange: (newValue) { - setState(() { - _selcetedIndex = newValue; - }); - print("Index: $_selcetedIndex"); - }, - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_package_components/Example/package_tiles/test_package_tile.dart b/mih_ui/lib/mih_package_components/Example/package_tiles/test_package_tile.dart deleted file mode 100644 index a3c2ca54..00000000 --- a/mih_ui/lib/mih_package_components/Example/package_tiles/test_package_tile.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class TestPackageTile extends StatefulWidget { - final double packageSize; - const TestPackageTile({ - super.key, - required this.packageSize, - }); - - @override - State createState() => _TestPackageTileState(); -} - -class _TestPackageTileState extends State { - @override - Widget build(BuildContext context) { - return MihPackageTile( - onTap: () { - context.goNamed( - 'testPackage', - ); - // Navigator.of(context).pushNamed( - // '/package-dev', - // arguments: TestArguments( - // widget.signedInUser, - // widget.business, - // ), - // ); - }, - appName: "Test", - appIcon: Icon( - Icons.warning_amber_rounded, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - iconSize: widget.packageSize, - textColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/Example/package_tools/package_tool_one.dart b/mih_ui/lib/mih_package_components/Example/package_tools/package_tool_one.dart deleted file mode 100644 index 33ab49a1..00000000 --- a/mih_ui/lib/mih_package_components/Example/package_tools/package_tool_one.dart +++ /dev/null @@ -1,887 +0,0 @@ -import 'dart:io'; - -import 'package:country_code_picker/country_code_picker.dart'; -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:geolocator/geolocator.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_banner_ad.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_business_info_card.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_location_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_date_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_numeric_stepper.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_image_display.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_radio_options.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_time_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_toggle.dart'; -import 'package:redacted/redacted.dart'; - -class PackageToolOne extends StatefulWidget { - final AppUser user; - final Business? business; - const PackageToolOne({ - super.key, - required this.user, - required this.business, - }); - - @override - State createState() => _PackageToolOneState(); -} - -class _PackageToolOneState extends State { - late ImageProvider? imagePreview; - PlatformFile? file; - PlatformFile? imageFile; - TextEditingController _fileNameController = TextEditingController(); - TextEditingController _imagefileController = TextEditingController(); - TextEditingController _searchController = TextEditingController(); - TextEditingController _textFieldZeroController = TextEditingController(); - TextEditingController _textFieldOneController = TextEditingController(); - TextEditingController _textFieldTwoController = TextEditingController(); - TextEditingController _textFieldThreeController = TextEditingController(); - TextEditingController _textFieldFourController = TextEditingController(); - TextEditingController _textFieldFiveController = TextEditingController(); - TextEditingController _textFieldSixController = TextEditingController(); - TextEditingController _textFieldSevenController = TextEditingController(); - TextEditingController _textFieldEightController = TextEditingController(); - TextEditingController _textFieldNineController = TextEditingController(); - bool switchpositioin = true; - final FocusNode searchFocusNode = FocusNode(); - final _formKey = GlobalKey(); - late Future myCoordinates; - String myLocation = ""; - - void showTestFullWindow() { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return MihPackageWindow( - fullscreen: true, - windowTitle: "Test Full", - onWindowTapClose: () { - Navigator.of(context).pop(); - }, - windowBody: Text("Testing Window Body"), - ); - }, - ); - } - - void showTestWindow() { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return MihPackageWindow( - fullscreen: false, - borderOn: true, - foregroundColor: MihColors.getOrangeColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - backgroundColor: MihColors.getBluishPurpleColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - windowTitle: "Test No Full", - menuOptions: [ - SpeedDialChild( - child: Icon( - Icons.add, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Show New Window", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - // showTestWindow(); - }, - ), - ], - onWindowTapClose: () { - Navigator.of(context).pop(); - }, - windowBody: Text( - "Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body Testing Window Body "), - ); - }, - ); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(screenWidth), - ); - } - - @override - void dispose() { - _fileNameController.dispose(); - _imagefileController.dispose(); - _searchController.dispose(); - searchFocusNode.dispose(); - super.dispose(); - } - - @override - void initState() { - super.initState(); - setState(() { - imagePreview = null; - }); - } - - Widget getBody(double width) { - return Stack( - children: [ - MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0.075), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "Hello", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ], - ), - const SizedBox(height: 20), - Center( - child: MihButton( - onPressed: () { - KenLogger.success("Successfully tested"); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Success Logger", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - const SizedBox(height: 10), - Center( - child: MihButton( - onPressed: () { - KenLogger.error("Successfully tested"); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Error Logger", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - const SizedBox(height: 10), - Center( - child: MihButton( - onPressed: () { - KenLogger.warning("Successfully tested"); - }, - buttonColor: MihColors.getOrangeColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Warning Logger", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - const SizedBox(height: 10), - Center( - child: MihButton( - onPressed: () { - KenLogger.info("Successfully tested"); - }, - buttonColor: MihColors.getBluishPurpleColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Info Logger", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - const SizedBox(height: 10), - CountryCodePicker( - padding: EdgeInsetsGeometry.all(0), - onChanged: (selectedCode) { - debugPrint("Selected Country Code: $selectedCode"); - }, - initialSelection: '+27', - showDropDownButton: false, - pickerStyle: PickerStyle.bottomSheet, - dialogBackgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - barrierColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Center( - child: MihButton( - onPressed: () { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle( - message: "Getting your profile data", - ); - }, - ); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Show Loading", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - const SizedBox(height: 10), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "Personal Preview", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ], - ), - const SizedBox(height: 10), - // MihPersonalProfilePreview( - // user: widget.user, - // ), - const SizedBox(height: 10), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "Business Preview", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ], - ), - const SizedBox(height: 10), - FutureBuilder( - future: MIHLocationAPI().getGPSPosition(context), - builder: (context, asyncSnapshot) { - // print(asyncSnapshot.connectionState); - if (asyncSnapshot.connectionState == - ConnectionState.waiting) { - // return MihBusinessProfilePreview( - // business: widget.business, - // myLocation: null, - // ).redacted( - // context: context, - // redact: true, - // ); - return Container( - width: 150, - height: 50, - // color: Colors.black, - child: Center(child: CircularProgressIndicator()), - ); - } else if (asyncSnapshot.hasError || - !asyncSnapshot.hasData || - asyncSnapshot.data == null) { - return Container( - width: 150, - height: 50, - color: Colors.red, - child: Center(child: Text("Location unavailable")), - ); - } else { - // final myLocation = asyncSnapshot.data - // .toString() - // .replaceAll("Latitude: ", "") - // .replaceAll("Longitude: ", ""); - // print("My Location is this: $myLocation"); - // return widget.business != null - // ? MihBusinessProfilePreview( - // business: widget.business!, - // ) - return Text("NoBusiness Data"); - } - }), - // const SizedBox(height: 10), - // Text("This text should be redacted").redacted( - // context: context, - // redact: true, - // ), - MihBusinessCard( - business: Business( - "business_id", - "Name", - "type", - "registration_no", - "logo_name", - "logo_path", - "+27812345679", - "bus_email", - "app_id", - "gps_location", - "practice_no", - "vat_no", - "website", - "rating", - "mission_vision", - ), - // startUpSearch: '', - width: 300, - ).redacted( - context: context, - redact: true, - ), - const SizedBox(height: 10), - Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - thickness: 2, - ), - const SizedBox(height: 10), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "Ad Test", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ], - ), - if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) - MihBannerAd(), - const SizedBox(height: 10), - Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - thickness: 2, - ), - const SizedBox(height: 10), - MihForm( - formKey: _formKey, - formFields: [ - MihTextFormField( - width: 200, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: _textFieldZeroController, - multiLineInput: false, - requiredText: false, - hintText: "Username", - validator: (value) { - return MihValidationServices().validateUsername(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: _textFieldOneController, - multiLineInput: false, - requiredText: true, - hintText: "Email", - autofillHints: [AutofillHints.email], - validator: (value) { - return MihValidationServices().validateEmail(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: _textFieldTwoController, - multiLineInput: false, - requiredText: true, - hintText: "Password", - passwordMode: true, - autofillHints: [AutofillHints.password], - validator: (value) { - return MihValidationServices().validatePassword(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: _textFieldThreeController, - multiLineInput: false, - requiredText: true, - hintText: "Numbers Only", - numberMode: true, - validator: (value) => value == null || value.isEmpty - ? 'This Field is required' - : null, - ), - const SizedBox(height: 10), - MihNumericStepper( - controller: _textFieldFiveController, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - hintText: "Number Stepper", - requiredText: true, - minValue: 1, - maxValue: 5, - validationOn: true, - ), - const SizedBox(height: 10), - MihToggle( - hintText: "Toggle", - initialPostion: switchpositioin, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - secondaryFillColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - readOnly: false, - onChange: (value) { - setState(() { - switchpositioin = value; - }); - print("Toggle Value: $switchpositioin"); - }, - ), - const SizedBox(height: 10), - MihRadioOptions( - controller: _textFieldSixController, - hintText: "Radio Options", - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - secondaryFillColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - requiredText: true, - radioOptions: const ["Option 1", "Option 2"], - ), - const SizedBox(height: 10), - MihDropdownField( - controller: _textFieldNineController, - hintText: "Dropdown", - dropdownOptions: const [ - "Option 1", - "Option 2", - "Option 3", - ], - editable: true, - enableSearch: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - requiredText: true, - ), - const SizedBox(height: 10), - MihDateField( - controller: _textFieldSevenController, - labelText: "Date Field", - required: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTimeField( - controller: _textFieldEightController, - labelText: "Time Field", - required: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - height: 250, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: _textFieldFourController, - multiLineInput: true, - requiredText: false, - hintText: "Enter Multi Line Text", - validator: (value) { - return MihValidationServices() - .validateLength(_textFieldFourController.text, 50); - }, - ), - const SizedBox(height: 20), - Align( - alignment: Alignment.center, - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - // Process data - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar(content: Text("Input Valid")), - ); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - elevation: 10, - width: 300, - child: Text( - "Submit Form", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - const SizedBox(height: 10), - Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - thickness: 2, - ), - const SizedBox(height: 10), - MihSearchBar( - controller: _searchController, - hintText: "Ask Mzansi", - // prefixIcon: Icons.search, - prefixIcon: Icons.search, - prefixAltIcon: MihIcons.mzansiAi, - width: 300, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - hintColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onPrefixIconTap: () { - print("Search Icon Pressed: ${_searchController.text}"); - }, - searchFocusNode: searchFocusNode, - ), - const SizedBox(height: 20), - MihButton( - onPressed: () { - print("Button Pressed"); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Click Me", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 40), - MihButton( - onPressed: () { - print("Button Pressed"); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.delete, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - Text( - "Click Me", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - const SizedBox(height: 10), - MihButton( - onPressed: () { - print("Button Pressed"); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Click Me", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - Container( - color: Colors.black, - width: 200, - height: 200, - padding: EdgeInsets.zero, - alignment: Alignment.center, - child: IconButton.filled( - onPressed: () {}, - icon: Icon( - MihIcons.mihLogo, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - const SizedBox(height: 10), - MihCircleAvatar( - imageFile: imagePreview, - width: 50, - expandable: true, - editable: false, - fileNameController: _fileNameController, - userSelectedfile: file, - frameColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onChange: (selectedImage) { - setState(() { - file = selectedImage; - }); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: _fileNameController, - hintText: "Selected Avatar File", - requiredText: false, - readOnly: false, - ), - const SizedBox(height: 10), - MihImageDisplay( - imageFile: imagePreview, - width: 300, - height: 200, - editable: true, - fileNameController: _imagefileController, - userSelectedfile: imageFile, - onChange: (selectedFile) { - setState(() { - imageFile = selectedFile; - }); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: _imagefileController, - hintText: "Selected Image File", - requiredText: false, - readOnly: false, - ), - const SizedBox(height: 10), - ], - ), - ), - ), - Positioned( - right: 0, - bottom: 0, - child: MihFloatingMenu( - animatedIcon: AnimatedIcons.menu_close, - children: [ - SpeedDialChild( - child: Icon( - Icons.add, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Show New Window", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - showTestWindow(); - }, - ), - SpeedDialChild( - child: Icon( - Icons.add, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Show New Full Window", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - showTestFullWindow(); - }, - ), - ]), - ) - ], - ); - } -} diff --git a/mih_ui/lib/mih_package_components/Example/package_tools/package_tool_three.dart b/mih_ui/lib/mih_package_components/Example/package_tools/package_tool_three.dart deleted file mode 100644 index c91f3299..00000000 --- a/mih_ui/lib/mih_package_components/Example/package_tools/package_tool_three.dart +++ /dev/null @@ -1,128 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_objects/profile_link.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_profile_links.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; - -class PackageToolThree extends StatefulWidget { - const PackageToolThree({super.key}); - - @override - State createState() => _PackageToolThreeState(); -} - -class _PackageToolThreeState extends State { - @override - Widget build(BuildContext context) { - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(), - ); - } - - Widget getBody() { - List links = [ - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Youtube", - web_link: "https://www.youtube.com/@MzansiInnovationHub", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Threads", - web_link: "https://www.threads.com/@mzansi.innovation.hub", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "TikTok", - web_link: "https://www.tiktok.com/@mzansiinnovationhub", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "WhatsApp", - web_link: "https://whatsapp.com/channel/0029Vax3INCIyPtMn8KgeM2F", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Twitch", - web_link: "https://www.twitch.tv/mzansiinnovationhub", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Instagram", - web_link: "https://www.instagram.com/mzansi.innovation.hub/", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "X", - web_link: "https://x.com/mzansi_inno_hub", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "LinkedIn", - web_link: "https://www.linkedin.com/in/yasien-meth-172352108/", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Facebook", - web_link: "https://www.facebook.com/profile.php?id=61565345762136", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Reddit", - web_link: "https://www.reddit.com/r/Mzani_Innovation_Hub/", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Discord", - web_link: "https://discord.gg/ZtTZYd5d", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "My App", - web_link: "https://app.mzansi-innovation-hub.co.za/about", - ), - ]; - - return Stack( - children: [ - MihSingleChildScroll( - scrollbarOn: true, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - MihProfileLinks( - links: links, - // links: [], - ), - ], - ), - ), - ], - ); - } -} diff --git a/mih_ui/lib/mih_package_components/Example/package_tools/package_tool_two.dart b/mih_ui/lib/mih_package_components/Example/package_tools/package_tool_two.dart deleted file mode 100644 index 181f34b5..00000000 --- a/mih_ui/lib/mih_package_components/Example/package_tools/package_tool_two.dart +++ /dev/null @@ -1,70 +0,0 @@ -import 'package:custom_rating_bar/custom_rating_bar.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class PackageToolTwo extends StatefulWidget { - const PackageToolTwo({super.key}); - - @override - State createState() => _PackageToolTwoState(); -} - -class _PackageToolTwoState extends State { - @override - Widget build(BuildContext context) { - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(), - ); - } - - Widget getBody() { - return MihSingleChildScroll( - scrollbarOn: true, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Text( - "World", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 10), - RatingBar( - filledIcon: Icons.star, - emptyIcon: Icons.star_border, - onRatingChanged: (value) => debugPrint('$value'), - initialRating: 3, - maxRating: 5, - ), - const SizedBox(height: 10), - Container( - color: Colors.black, - width: 200, - height: 200, - padding: EdgeInsets.zero, - alignment: Alignment.center, - child: IconButton.filled( - onPressed: () {}, - icon: Icon( - MihIcons.mihLogo, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ) - ], - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/Example/package_tools/package_tool_zero.dart b/mih_ui/lib/mih_package_components/Example/package_tools/package_tool_zero.dart deleted file mode 100644 index 7bf24130..00000000 --- a/mih_ui/lib/mih_package_components/Example/package_tools/package_tool_zero.dart +++ /dev/null @@ -1,466 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; - -class PackageToolZero extends StatefulWidget { - const PackageToolZero({super.key}); - - @override - State createState() => _PackageToolZeroState(); -} - -class _PackageToolZeroState extends State { - @override - Widget build(BuildContext context) { - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(), - ); - } - - Widget getBody() { - return MihSingleChildScroll( - scrollbarOn: true, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - "This is Package Tool Zero to test MIH Alerts", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 24, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 20), - MihButton( - width: 300, - onPressed: () { - MihAlertServices().successBasicAlert( - "Success!", - "This is the message for the success message", - context, - ); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Text( - "Basic Success Alert", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - MihButton( - width: 300, - onPressed: () { - MihAlertServices().successAdvancedAlert( - "Success!", - "This is the advanced alert message", - [ - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Okay", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Text( - "Advanced Success Alert", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - MihButton( - width: 300, - onPressed: () { - MihAlertServices().warningAlert( - "Warning Alert!", "This is a friendly warning mee", context); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Text( - "Warning Alert", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - MihButton( - width: 300, - onPressed: () { - MihAlertServices().warningAdvancedAlert( - "warning!", - "This is the advanced alert message", - [ - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Okay", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Text( - "Advanced Warning Alert", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - MihButton( - width: 300, - onPressed: () { - MihAlertServices().errorBasicAlert( - "Error!", - "Thisis the basic error alert message", - context, - ); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - child: Text( - "Basic Error Alert", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - MihButton( - width: 300, - onPressed: () { - MihAlertServices().errorAdvancedAlert( - "Error!", - "This is the advanced alert message", - [ - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Okay", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - child: Text( - "Advanced Error Alert", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - MihButton( - width: 300, - onPressed: () { - MihAlertServices().deleteConfirmationAlert( - "THis is a delete confirmation", - () { - context.pop(); - }, - context, - ); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - child: Text( - "Delete Confirmation Alert", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - MihButton( - width: 300, - onPressed: () { - MihAlertServices().internetConnectionAlert(context); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - child: Text( - "Internet Connection Alert", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - MihButton( - width: 300, - onPressed: () { - MihAlertServices().locationPermissionAlert(context); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - child: Text( - "Location Permission Alert", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - MihButton( - width: 300, - onPressed: () { - MihAlertServices().inputErrorAlert(context); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - child: Text( - "Input Error Alert", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - MihButton( - width: 300, - onPressed: () { - MihAlertServices().passwordRequirementAlert(context); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - child: FittedBox( - child: Text( - "Password Requirement Alert", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - const SizedBox(height: 10), - MihButton( - width: 300, - onPressed: () { - MihAlertServices().passwordMatchAlert(context); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - child: Text( - "Password Match Alert", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - MihButton( - width: 300, - onPressed: () { - MihAlertServices().loginErrorAlert(context); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - child: Text( - "Login Error Alert", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - MihButton( - width: 300, - onPressed: () { - MihAlertServices().emailExistsAlert(context); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - child: Text( - "Email Exists Alert", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - MihButton( - width: 300, - onPressed: () { - MihAlertServices().invalidEmailAlert(context); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - child: Text( - "Invalid Email Alert", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - ], - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/assets/fonts/Mih_Icons.ttf b/mih_ui/lib/mih_package_components/assets/fonts/Mih_Icons.ttf deleted file mode 100644 index a908997c..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/fonts/Mih_Icons.ttf and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/fonts/icomoon_link.txt b/mih_ui/lib/mih_package_components/assets/fonts/icomoon_link.txt deleted file mode 100644 index 0e7d4528..00000000 --- a/mih_ui/lib/mih_package_components/assets/fonts/icomoon_link.txt +++ /dev/null @@ -1 +0,0 @@ -/* Mih Icons - https://icomoon.io/*/ \ No newline at end of file diff --git a/mih_ui/lib/mih_package_components/assets/fonts/style.css b/mih_ui/lib/mih_package_components/assets/fonts/style.css deleted file mode 100644 index 9b49c4fc..00000000 --- a/mih_ui/lib/mih_package_components/assets/fonts/style.css +++ /dev/null @@ -1,99 +0,0 @@ -@font-face { - font-family: 'icomoon'; - src: url('fonts/icomoon.eot?8flwgj'); - src: url('fonts/icomoon.eot?8flwgj#iefix') format('embedded-opentype'), - url('fonts/icomoon.ttf?8flwgj') format('truetype'), - url('fonts/icomoon.woff?8flwgj') format('woff'), - url('fonts/icomoon.svg?8flwgj#icomoon') format('svg'); - font-weight: normal; - font-style: normal; - font-display: block; -} - -[class^="icon-"], -[class*=" icon-"] { - /* use !important to prevent issues with browser extensions that change fonts */ - font-family: 'icomoon' !important; - /* speak: never; */ - font-style: normal; - font-weight: normal; - font-variant: normal; - text-transform: none; - line-height: 1; - - /* Better Font Rendering =========== */ - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -.icon-mine_sweeper:before { - content: "\e900"; -} - -.icon-mzansi_directory:before { - content: "\e901"; -} - -.icon-personal_profile:before { - content: "\e902"; -} - -.icon-about_mih:before { - content: "\e903"; -} - -.icon-access_control:before { - content: "\e904"; -} - -.icon-business_profile:before { - content: "\e905"; -} - -.icon-business_setup:before { - content: "\e906"; -} - -.icon-calculator:before { - content: "\e907"; -} - -.icon-calendar:before { - content: "\e908"; -} - -.icon-i_dont_know:before { - content: "\e909"; -} - -.icon-mih_logo:before { - content: "\e90a"; -} - -.icon-mih_ring:before { - content: "\e90b"; -} - -.icon-mzansi_ai:before { - content: "\e90c"; -} - -.icon-mzansi_wallet:before { - content: "\e90d"; -} - -.icon-notifications:before { - content: "\e90e"; -} - -.icon-patient_manager:before { - content: "\e90f"; -} - -.icon-patient_profile:before { - content: "\e910"; -} - -.icon-profile_setup:before { - content: "\e911"; -} \ No newline at end of file diff --git a/mih_ui/lib/mih_package_components/assets/images/app_icon/circle_logo.png b/mih_ui/lib/mih_package_components/assets/images/app_icon/circle_logo.png deleted file mode 100644 index 1041552c..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/app_icon/circle_logo.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/app_icon/mih_app_icon.png b/mih_ui/lib/mih_package_components/assets/images/app_icon/mih_app_icon.png deleted file mode 100644 index 0ec5870d..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/app_icon/mih_app_icon.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/app_icon/mih_logo_app.png b/mih_ui/lib/mih_package_components/assets/images/app_icon/mih_logo_app.png deleted file mode 100644 index 136db5ef..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/app_icon/mih_logo_app.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/app_icon/mih_logo_app_w4c.png b/mih_ui/lib/mih_package_components/assets/images/app_icon/mih_logo_app_w4c.png deleted file mode 100644 index dbcffcbf..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/app_icon/mih_logo_app_w4c.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/app_icon/mih_logo_web.png b/mih_ui/lib/mih_package_components/assets/images/app_icon/mih_logo_web.png deleted file mode 100644 index 8394f8e8..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/app_icon/mih_logo_web.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/app_icon/mih_logo_web_w4c.png b/mih_ui/lib/mih_package_components/assets/images/app_icon/mih_logo_web_w4c.png deleted file mode 100644 index 5026c49a..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/app_icon/mih_logo_web_w4c.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/founder.jpg b/mih_ui/lib/mih_package_components/assets/images/founder.jpg deleted file mode 100644 index 52a66923..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/founder.jpg and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/i-dont-know-dark.png b/mih_ui/lib/mih_package_components/assets/images/i-dont-know-dark.png deleted file mode 100644 index a9e5cff9..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/i-dont-know-dark.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/i-dont-know-light.png b/mih_ui/lib/mih_package_components/assets/images/i-dont-know-light.png deleted file mode 100644 index 69e2ea5b..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/i-dont-know-light.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/logo_light.png b/mih_ui/lib/mih_package_components/assets/images/logo_light.png deleted file mode 100644 index f412a61d..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/logo_light.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/apple_tree-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/apple_tree-min.png deleted file mode 100644 index 7c6bcc2c..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/apple_tree-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/auchan-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/auchan-min.png deleted file mode 100644 index c56b2c8e..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/auchan-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/best_before-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/best_before-min.png deleted file mode 100644 index b4ed8df4..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/best_before-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/big_save-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/big_save-min.png deleted file mode 100644 index e08ecbae..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/big_save-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/boxer-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/boxer-min.png deleted file mode 100644 index 79b5a3b5..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/boxer-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/bp-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/bp-min.png deleted file mode 100644 index 8a1b744f..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/bp-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/builders-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/builders-min.png deleted file mode 100644 index f458b624..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/builders-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/carrefour-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/carrefour-min.png deleted file mode 100644 index f12eae43..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/carrefour-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/checkers-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/checkers-min.png deleted file mode 100644 index bab0d78e..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/checkers-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/choppies-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/choppies-min.png deleted file mode 100644 index 236933d1..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/choppies-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/clicks-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/clicks-min.png deleted file mode 100644 index d7805ce6..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/clicks-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/continente-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/continente-min.png deleted file mode 100644 index 2cf906bf..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/continente-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/cotton_on-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/cotton_on-min.png deleted file mode 100644 index ab78024b..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/cotton_on-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/dischem-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/dischem-min.png deleted file mode 100644 index 51b45297..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/dischem-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/edgars-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/edgars-min.png deleted file mode 100644 index 38f7731a..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/edgars-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/engen-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/engen-min.png deleted file mode 100644 index fb37347c..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/engen-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/eskom-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/eskom-min.png deleted file mode 100644 index 65e89512..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/eskom-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/exclusive_books-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/exclusive_books-min.png deleted file mode 100644 index f7c0ef96..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/exclusive_books-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/fresh_stop-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/fresh_stop-min.png deleted file mode 100644 index 0ccae894..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/fresh_stop-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/fresmart-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/fresmart-min.png deleted file mode 100644 index 976dbfa2..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/fresmart-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/infinity-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/infinity-min.png deleted file mode 100644 index a5545716..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/infinity-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/jet-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/jet-min.png deleted file mode 100644 index 8577c89f..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/jet-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/justrite-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/justrite-min.png deleted file mode 100644 index e8415542..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/justrite-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/kero-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/kero-min.png deleted file mode 100644 index ff92d6cc..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/kero-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/leroy_merlin-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/leroy_merlin-min.png deleted file mode 100644 index 45804ed8..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/leroy_merlin-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/makro-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/makro-min.png deleted file mode 100644 index dff25561..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/makro-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/naivas-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/naivas-min.png deleted file mode 100644 index 6a17466b..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/naivas-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/ok_food-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/ok_food-min.png deleted file mode 100644 index 4bf05cef..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/ok_food-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/panarottis-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/panarottis-min.png deleted file mode 100644 index b8542eaa..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/panarottis-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/pick_n_pay-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/pick_n_pay-min.png deleted file mode 100644 index 586ef48f..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/pick_n_pay-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/plus_more-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/plus_more-min.png deleted file mode 100644 index e00d7ea0..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/plus_more-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/pna-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/pna-min.png deleted file mode 100644 index 1851f287..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/pna-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/pq-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/pq-min.png deleted file mode 100644 index 9716ed4b..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/pq-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/rage-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/rage-min.png deleted file mode 100644 index 55f35231..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/rage-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/sasol-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/sasol-min.png deleted file mode 100644 index 3ba043c6..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/sasol-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/sefalana-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/sefalana-min.png deleted file mode 100644 index bab67133..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/sefalana-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/shell-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/shell-min.png deleted file mode 100644 index 693fc5d6..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/shell-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/shoprite-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/shoprite-min.png deleted file mode 100644 index 448813ad..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/shoprite-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/signature_cosmetics-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/signature_cosmetics-min.png deleted file mode 100644 index 4b756e1f..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/signature_cosmetics-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/spar-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/spar-min.png deleted file mode 100644 index fb55b121..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/spar-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/spur-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/spur-min.png deleted file mode 100644 index 5186d7a3..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/spur-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/tfg-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/tfg-min.png deleted file mode 100644 index e4d98f9b..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/tfg-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/total_energies-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/total_energies-min.png deleted file mode 100644 index a33f5250..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/total_energies-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/toysrus-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/toysrus-min.png deleted file mode 100644 index 4b7c0f20..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/toysrus-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/woermann_brock-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/woermann_brock-min.png deleted file mode 100644 index 5bfb2c60..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/woermann_brock-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/woolworths-min.png b/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/woolworths-min.png deleted file mode 100644 index 8265f504..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/loyalty_cards/mini/woolworths-min.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/splash_screen/mih_branding_splash.png b/mih_ui/lib/mih_package_components/assets/images/splash_screen/mih_branding_splash.png deleted file mode 100644 index a737b7f7..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/splash_screen/mih_branding_splash.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/splash_screen/mih_branding_splash_temp.gif b/mih_ui/lib/mih_package_components/assets/images/splash_screen/mih_branding_splash_temp.gif deleted file mode 100644 index eea9f00f..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/splash_screen/mih_branding_splash_temp.gif and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/splash_screen/mih_image_splash.png b/mih_ui/lib/mih_package_components/assets/images/splash_screen/mih_image_splash.png deleted file mode 100644 index b045151d..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/splash_screen/mih_image_splash.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/splash_screen/mih_image_splash_android.png b/mih_ui/lib/mih_package_components/assets/images/splash_screen/mih_image_splash_android.png deleted file mode 100644 index 7540afb8..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/splash_screen/mih_image_splash_android.png and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/assets/images/splash_screen/mih_image_splash_temp.gif b/mih_ui/lib/mih_package_components/assets/images/splash_screen/mih_image_splash_temp.gif deleted file mode 100644 index d4a7864b..00000000 Binary files a/mih_ui/lib/mih_package_components/assets/images/splash_screen/mih_image_splash_temp.gif and /dev/null differ diff --git a/mih_ui/lib/mih_package_components/mih_banner_ad.dart b/mih_ui/lib/mih_package_components/mih_banner_ad.dart deleted file mode 100644 index fa2807db..00000000 --- a/mih_ui/lib/mih_package_components/mih_banner_ad.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:google_mobile_ads/google_mobile_ads.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_banner_ad_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:provider/provider.dart'; - -class MihBannerAd extends StatefulWidget { - const MihBannerAd({super.key}); - - @override - State createState() => _MihBannerAdState(); -} - -class _MihBannerAdState extends State { - @override - void dispose() { - super.dispose(); - } - - @override - void initState() { - super.initState(); - MihBannerAdProvider adProvider = context.read(); - WidgetsBinding.instance.addPostFrameCallback((_) { - adProvider.reset(); - adProvider.loadBannerAd(); - }); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (context, bannerAdProvider, child) { - if (!bannerAdProvider.isBannerAdLoaded) { - return SizedBox(); - } - return Column( - children: [ - bannerAdProvider.bannerAd != null && - bannerAdProvider.isBannerAdLoaded - ? SizedBox( - width: bannerAdProvider.bannerAd!.size.width.toDouble(), - height: bannerAdProvider.bannerAd!.size.height.toDouble(), - child: AdWidget(ad: bannerAdProvider.bannerAd!)) - : SizedBox( - child: Text(AppEnviroment.getEnv() == "Dev" - ? bannerAdProvider.errorMessage - : ""), - ), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_business_info_card.dart b/mih_ui/lib/mih_package_components/mih_business_info_card.dart deleted file mode 100644 index b17b53a6..00000000 --- a/mih_ui/lib/mih_package_components/mih_business_info_card.dart +++ /dev/null @@ -1,703 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/bookmarked_business.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business_review.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_add_bookmark_alert.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_delete_bookmark_alert.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart'; -import 'package:provider/provider.dart'; -import 'package:redacted/redacted.dart'; -import 'package:supertokens_flutter/supertokens.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class MihBusinessCard extends StatefulWidget { - final Business business; - final double width; - const MihBusinessCard({ - super.key, - required this.business, - required this.width, - }); - - @override - State createState() => _MihBusinessCardState(); -} - -class _MihBusinessCardState extends State { - Future? _businessReviewFuture; - Future? _bookmarkedBusinessFuture; - bool _isUserSignedIn = false; - - Future _checkUserSession() async { - final doesSessionExist = await SuperTokens.doesSessionExist(); - setState(() { - _isUserSignedIn = doesSessionExist; - }); - } - - RedactedConfiguration getRedactedConfiguration() { - return RedactedConfiguration( - // redactedColor: Colors.pink, - redactedColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } - - Future _makePhoneCall(String phoneNumber) async { - String formattedNumber = phoneNumber.replaceAll("-", ""); - final Uri url = Uri(scheme: 'tel', path: formattedNumber); - if (await canLaunchUrl(url)) { - await launchUrl(url); - } else { - MihAlertServices().errorBasicAlert( - "Error Making Call", - "We couldn't open your phone app to call $formattedNumber. To fix this, make sure you have a phone application installed and it's set as your default dialer.", - context, - ); - } - } - - String? _encodeQueryParameters(Map params) { - return params.entries - .map((MapEntry e) => - '${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value)}') - .join('&'); - } - - Future _launchEmail( - String recipient, String subject, String body) async { - final Uri emailLaunchUri = Uri( - scheme: 'mailto', - path: recipient, - query: _encodeQueryParameters({ - 'subject': subject, - 'body': body, - }), - ); - - if (await canLaunchUrl(emailLaunchUri)) { - await launchUrl(emailLaunchUri); - } else { - MihAlertServices().errorBasicAlert( - "Error Creating Email", - "We couldn't launch your email app to send a message to $recipient. To fix this, please confirm that you have an email application installed and that it's set as your default.", - context, - ); - } - } - - Future _launchGoogleMapsWithUrl({ - required double latitude, - required double longitude, - String? label, - }) async { - final Uri googleMapsUrl = Uri.parse( - 'https://www.google.com/maps/search/?api=1&query=$latitude,$longitude${label != null ? '&query_place_id=' : ''}', - ); - try { - if (await canLaunchUrl(googleMapsUrl)) { - await launchUrl(googleMapsUrl); - } else { - MihAlertServices().errorBasicAlert( - "Error Opening Maps", - "There was an issue opening maps for ${widget.business.Name}. This usually happens if you don't have a maps app installed or it's not set as your default. Please install one to proceed.", - context, - ); - } - } catch (e) { - MihAlertServices().errorBasicAlert( - "Error Opening Maps", - "There was an issue opening maps for ${widget.business.Name}. This usually happens if you don't have a maps app installed or it's not set as your default. Please install one to proceed.", - context, - ); - } - } - - Future _launchWebsite(String urlString) async { - String newUrl = urlString; - if (!newUrl.startsWith("https://")) { - newUrl = "https://$urlString"; - } - final Uri url = Uri.parse(newUrl); - try { - if (await canLaunchUrl(url)) { - await launchUrl(url); - } else { - MihAlertServices().errorBasicAlert( - "Error Opening Website", - "We couldn't open the link to $newUrl. To view this website, please ensure you have a web browser installed and set as your default.", - context, - ); - } - } catch (e) { - MihAlertServices().errorBasicAlert( - "Error Opening Website", - "We couldn't open the link to $newUrl. To view this website, please ensure you have a web browser installed and set as your default.", - context, - ); - } - } - - Widget _buildContactInfo( - String label, - String subLabel, - IconData icon, - Color? iconColor, - bool redacted, - Function()? ontap, - ) { - return Material( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: InkWell( - onTap: ontap, - splashColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark") - .withOpacity(0.2), - borderRadius: BorderRadius.circular(15), - child: Padding( - padding: EdgeInsetsGeometry.symmetric( - // vertical: 5, - horizontal: 25, - ), - child: Row( - children: [ - Container( - width: 45, - height: 45, - decoration: BoxDecoration( - color: iconColor, - borderRadius: BorderRadius.circular(15), - ), - padding: const EdgeInsets.all(5.0), - child: FittedBox( - child: Icon( - icon, - // size: 35, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ).redacted( - context: context, - redact: redacted, - configuration: getRedactedConfiguration(), - ), - SizedBox(width: 20), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - label, - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - height: 1.0, - ), - ).redacted( - context: context, - redact: redacted, - configuration: getRedactedConfiguration(), - ), - Text( - subLabel, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w700, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ).redacted( - context: context, - redact: redacted, - configuration: getRedactedConfiguration(), - ), - ], - ), - ), - ], - ), - ), - ), - ); - } - - Future getUserReview() async { - String user_id = await SuperTokens.getUserId(); - return await MihMzansiDirectoryServices().getUserReviewOfBusiness( - user_id, - widget.business.business_id, - ); - } - - Future getUserBookmark() async { - String user_id = await SuperTokens.getUserId(); - return await MihMzansiDirectoryServices().getUserBookmarkOfBusiness( - user_id, - widget.business.business_id, - ); - } - - bool isValidGps(String coordinateString) { - final RegExp gpsRegex = RegExp( - r"^-?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*-?(1[0-7]\d(\.\d+)?|180(\.0+)?|\d{1,2}(\.\d+)?)$"); - return gpsRegex.hasMatch(coordinateString); - } - - @override - void initState() { - super.initState(); - _checkUserSession(); - _businessReviewFuture = getUserReview(); - _bookmarkedBusinessFuture = getUserBookmark(); - } - - @override - Widget build(BuildContext context) { - // double screenWidth = MediaQuery.of(context).size.width; - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - MzansiDirectoryProvider directoryProvider, Widget? child) { - return Material( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark") - .withValues(alpha: 0.6), - borderRadius: BorderRadius.circular(25), - elevation: 10, - shadowColor: Colors.black, - child: Container( - decoration: BoxDecoration( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(10), - ), - child: Column( - children: [ - const SizedBox(height: 10), - _buildContactInfo( - "Call", - "Give us a quick call.", - Icons.phone, - MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - false, - () { - // print("Calling ${widget.cellNumber}"); - _makePhoneCall(widget.business.contact_no); - }, - ), - Divider( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - _buildContactInfo( - "Email", - "Send us an email.", - Icons.email, - MihColors.getPinkColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - false, - () { - // print("Emailing ${widget.email}"); - _launchEmail( - widget.business.bus_email, - "Inquiery about ${widget.business.Name}", - "Dear ${widget.business.Name},\n\nI would like to inquire about your services.\n\nBest regards,\n", - ); - }, - ), - Visibility( - visible: isValidGps(widget.business.gps_location), - child: Column( - children: [ - Divider( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - _buildContactInfo( - "Location", - "Come visit us.", - Icons.location_on, - MihColors.getOrangeColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - false, - () { - final latitude = double.parse( - widget.business.gps_location.split(',')[0]); - final longitude = double.parse( - widget.business.gps_location.split(',')[1]); - _launchGoogleMapsWithUrl( - latitude: latitude, - longitude: longitude, - ); - }, - ), - ], - ), - ), - Visibility( - visible: widget.business.website.isNotEmpty && - widget.business.website != "", - child: Column( - children: [ - Divider( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - _buildContactInfo( - "Website", - "Find out more about us.", - Icons.vpn_lock, - MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - false, - () { - _launchWebsite(widget.business.website); - }, - ), - ], - ), - ), - FutureBuilder( - future: _businessReviewFuture, - builder: (context, asyncSnapshot) { - if (asyncSnapshot.connectionState == - ConnectionState.waiting) { - // return const SizedBox.shrink(); - return Column( - children: [ - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 10.0), - child: Divider( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - Container( - child: _buildContactInfo( - "Loading Rating", - "Loading your rating.", - Icons.star_rate_rounded, - MihColors.getYellowColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - true, - null, - ), - ).redacted(context: context, redact: true), - ], - ); - } else { - BusinessReview? businessReview = asyncSnapshot.data; - String ratingDisplayTitle = ""; - if (businessReview == null) { - ratingDisplayTitle = "Rate Us"; - } else { - ratingDisplayTitle = "Update Rating"; - } - return Column( - children: [ - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 10.0), - child: Divider( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - _buildContactInfo( - ratingDisplayTitle, - "Let us know how we are doing.", - Icons.star_rate_rounded, - MihColors.getYellowColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - false, - () { - businessReviewRatingWindow(directoryProvider, - businessReview, true, widget.width); - }, - ), - ], - ); - } - }, - ), - FutureBuilder( - future: _bookmarkedBusinessFuture, - builder: (context, asyncSnapshot) { - if (asyncSnapshot.connectionState == - ConnectionState.waiting) { - // return const SizedBox.shrink(); - return Column( - children: [ - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 10.0), - child: Divider( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - Container( - child: _buildContactInfo( - "Loading Bookmark", - "Loading your bookmark.", - Icons.bookmark_add_rounded, - MihColors.getBluishPurpleColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - true, - null, - ), - ), - ], - ); - } else { - BookmarkedBusiness? bookmarkBusiness = asyncSnapshot.data; - String bookmarkDisplayTitle = ""; - if (bookmarkBusiness == null) { - bookmarkDisplayTitle = "Bookmark Us"; - } else { - bookmarkDisplayTitle = "Remove Bookmark"; - } - return Column( - children: [ - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 10.0), - child: Divider( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - _buildContactInfo( - bookmarkDisplayTitle, - "Save us for later.", - bookmarkBusiness == null - ? Icons.bookmark_add_rounded - : Icons.bookmark_remove_rounded, - MihColors.getBluishPurpleColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - false, - () { - // _launchWebsite(widget.website); - if (bookmarkBusiness == null) { - showAddBookmarkAlert(); - } else { - showDeleteBookmarkAlert(bookmarkBusiness); - } - }, - ), - ], - ); - } - }, - ), - // Padding( - // padding: const EdgeInsets.symmetric(horizontal: 10.0), - // child: Divider( - // color: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - // ), - // _buildContactInfo( - // "Bookmark", - // "Save us for later.", - // Icons.bookmark_add_rounded, - // MihColors.getBluishPurpleColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // () { - // // _launchWebsite(widget.website); - // print("Saving ${widget.business.Name} to Directory"); - // showBookmarkAlert(); - // }, - // ), - const SizedBox(height: 10), - // Padding( - // padding: const EdgeInsets.symmetric(horizontal: 10.0), - // child: Divider( - // color: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - // ), - ], - ), - ), - ); - }, - ); - } - - Future businessReviewRatingWindow( - MzansiDirectoryProvider directoryProvider, - BusinessReview? myReview, - bool previouslyRated, - double width) async { - if (_isUserSignedIn) { - showDialog( - barrierDismissible: false, - context: context, - builder: (context) => MihReviewBusinessWindow( - business: widget.business, - businessReview: myReview, - screenWidth: width, - readOnly: false, - onSuccessDismissPressed: () async { - List? businessSearchResults = []; - businessSearchResults = await MihBusinessDetailsServices() - .searchBusinesses(directoryProvider.searchTerm, - directoryProvider.businessTypeFilter, context); - Map> busImagesUrl = {}; - Future businessLogoUrl; - for (var bus in businessSearchResults) { - businessLogoUrl = MihFileApi.getMinioFileUrl(bus.logo_path); - busImagesUrl[bus.business_id] = businessLogoUrl; - } - directoryProvider.setSearchedBusinesses( - searchedBusinesses: businessSearchResults, - businessesImagesUrl: busImagesUrl, - ); - setState(() { - _businessReviewFuture = getUserReview(); - }); - }, - ), - ); - } else { - showSignInRequiredAlert(); - } - } - - void showAddBookmarkAlert() { - if (_isUserSignedIn) { - showDialog( - barrierDismissible: false, - context: context, - builder: (context) => MihAddBookmarkAlert( - business: widget.business, - onSuccessDismissPressed: () async { - _bookmarkedBusinessFuture = getUserBookmark(); - }, - ), - ); - } else { - showSignInRequiredAlert(); - } - } - - void showDeleteBookmarkAlert(BookmarkedBusiness? bookmarkBusiness) { - if (_isUserSignedIn) { - showDialog( - barrierDismissible: false, - context: context, - builder: (context) => MihDeleteBookmarkAlert( - business: widget.business, - bookmarkBusiness: bookmarkBusiness, - onSuccessDismissPressed: () { - _bookmarkedBusinessFuture = getUserBookmark(); - }, - // startUpSearch: widget.startUpSearch, - )); - } else { - showSignInRequiredAlert(); - } - } - - void showSignInRequiredAlert() { - showDialog( - barrierDismissible: false, - context: context, - builder: (context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: () { - context.pop(); - }, - windowBody: Column( - children: [ - Icon( - MihIcons.mihLogo, - size: 125, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "Let's Get Started", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - Text( - "Ready to dive in to the world of MIH?\nSign in or create a free MIH account to unlock all the powerful features of the MIH app. It's quick and easy!", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 15, - ), - ), - const SizedBox(height: 25), - Center( - child: MihButton( - onPressed: () { - context.goNamed( - 'mihHome', - extra: true, - ); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Sign In/ Create Account", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_business_info_card_v2.dart b/mih_ui/lib/mih_package_components/mih_business_info_card_v2.dart deleted file mode 100644 index 2c9684d7..00000000 --- a/mih_ui/lib/mih_package_components/mih_business_info_card_v2.dart +++ /dev/null @@ -1,659 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/bookmarked_business.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business_review.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_add_bookmark_alert.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_delete_bookmark_alert.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart'; -import 'package:provider/provider.dart'; -import 'package:redacted/redacted.dart'; -import 'package:supertokens_flutter/supertokens.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class MihBusinessCardV2 extends StatefulWidget { - final Business business; - final double width; - const MihBusinessCardV2({ - super.key, - required this.business, - required this.width, - }); - - @override - State createState() => _MihBusinessCardV2State(); -} - -class _MihBusinessCardV2State extends State { - Future? _businessReviewFuture; - Future? _bookmarkedBusinessFuture; - bool _isUserSignedIn = false; - - Future _checkUserSession() async { - final doesSessionExist = await SuperTokens.doesSessionExist(); - setState(() { - _isUserSignedIn = doesSessionExist; - }); - } - - RedactedConfiguration getRedactedConfiguration() { - return RedactedConfiguration( - // redactedColor: Colors.pink, - redactedColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } - - Future _makePhoneCall(String phoneNumber) async { - String formattedNumber = phoneNumber.replaceAll("-", ""); - final Uri url = Uri(scheme: 'tel', path: formattedNumber); - if (await canLaunchUrl(url)) { - await launchUrl(url); - } else { - MihAlertServices().errorBasicAlert( - "Error Making Call", - "We couldn't open your phone app to call $formattedNumber. To fix this, make sure you have a phone application installed and it's set as your default dialer.", - context, - ); - } - } - - String? _encodeQueryParameters(Map params) { - return params.entries - .map((MapEntry e) => - '${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value)}') - .join('&'); - } - - Future _launchEmail( - String recipient, String subject, String body) async { - final Uri emailLaunchUri = Uri( - scheme: 'mailto', - path: recipient, - query: _encodeQueryParameters({ - 'subject': subject, - 'body': body, - }), - ); - - if (await canLaunchUrl(emailLaunchUri)) { - await launchUrl(emailLaunchUri); - } else { - MihAlertServices().errorBasicAlert( - "Error Creating Email", - "We couldn't launch your email app to send a message to $recipient. To fix this, please confirm that you have an email application installed and that it's set as your default.", - context, - ); - } - } - - Future _launchGoogleMapsWithUrl({ - required double latitude, - required double longitude, - String? label, - }) async { - final Uri googleMapsUrl = Uri.parse( - 'https://www.google.com/maps/search/?api=1&query=$latitude,$longitude${label != null ? '&query_place_id=' : ''}', - ); - try { - if (await canLaunchUrl(googleMapsUrl)) { - await launchUrl(googleMapsUrl); - } else { - MihAlertServices().errorBasicAlert( - "Error Opening Maps", - "There was an issue opening maps for ${widget.business.Name}. This usually happens if you don't have a maps app installed or it's not set as your default. Please install one to proceed.", - context, - ); - } - } catch (e) { - MihAlertServices().errorBasicAlert( - "Error Opening Maps", - "There was an issue opening maps for ${widget.business.Name}. This usually happens if you don't have a maps app installed or it's not set as your default. Please install one to proceed.", - context, - ); - } - } - - Future _launchWebsite(String urlString) async { - String newUrl = urlString; - if (!newUrl.startsWith("https://")) { - newUrl = "https://$urlString"; - } - final Uri url = Uri.parse(newUrl); - try { - if (await canLaunchUrl(url)) { - await launchUrl(url); - } else { - MihAlertServices().errorBasicAlert( - "Error Opening Website", - "We couldn't open the link to $newUrl. To view this website, please ensure you have a web browser installed and set as your default.", - context, - ); - } - } catch (e) { - MihAlertServices().errorBasicAlert( - "Error Opening Website", - "We couldn't open the link to $newUrl. To view this website, please ensure you have a web browser installed and set as your default.", - context, - ); - } - } - - Future getUserReview() async { - String user_id = await SuperTokens.getUserId(); - return await MihMzansiDirectoryServices().getUserReviewOfBusiness( - user_id, - widget.business.business_id, - ); - } - - Future getUserBookmark() async { - String user_id = await SuperTokens.getUserId(); - return await MihMzansiDirectoryServices().getUserBookmarkOfBusiness( - user_id, - widget.business.business_id, - ); - } - - bool isValidGps(String coordinateString) { - final RegExp gpsRegex = RegExp( - r"^-?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*-?(1[0-7]\d(\.\d+)?|180(\.0+)?|\d{1,2}(\.\d+)?)$"); - return gpsRegex.hasMatch(coordinateString); - } - - @override - void initState() { - super.initState(); - _checkUserSession(); - _businessReviewFuture = getUserReview(); - _bookmarkedBusinessFuture = getUserBookmark(); - } - - @override - Widget build(BuildContext context) { - // double screenWidth = MediaQuery.of(context).size.width; - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - MzansiDirectoryProvider directoryProvider, Widget? child) { - double iconSize = 50.0; - return Wrap( - alignment: WrapAlignment.center, - runSpacing: 10, - spacing: 10, - children: [ - Column( - children: [ - MihButton( - width: 80, - height: 80, - onPressed: () { - _makePhoneCall(widget.business.contact_no); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Icon( - Icons.phone, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - size: iconSize, - ), - ), - const SizedBox(height: 2), - FittedBox( - child: Text( - "Call", - style: TextStyle( - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - ), - ), - ), - ], - ), - Column( - children: [ - MihButton( - width: 80, - height: 80, - onPressed: () { - _launchEmail( - widget.business.bus_email, - "Inquiery about ${widget.business.Name}", - "Dear ${widget.business.Name},\n\nI would like to inquire about your services.\n\nBest regards,\n", - ); - }, - buttonColor: MihColors.getPinkColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Icon( - Icons.email, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - size: iconSize, - ), - ), - const SizedBox(height: 2), - FittedBox( - child: Text( - "Email", - style: TextStyle( - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - ), - ), - ), - ], - ), - if (isValidGps(widget.business.gps_location)) - Column( - children: [ - MihButton( - width: 80, - height: 80, - onPressed: () { - final latitude = double.parse( - widget.business.gps_location.split(',')[0]); - final longitude = double.parse( - widget.business.gps_location.split(',')[1]); - _launchGoogleMapsWithUrl( - latitude: latitude, - longitude: longitude, - ); - }, - buttonColor: MihColors.getOrangeColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Icon( - Icons.location_on, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - size: iconSize, - ), - ), - const SizedBox(height: 2), - FittedBox( - child: Text( - "Maps", - style: TextStyle( - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - ), - ), - ), - ], - ), - if (widget.business.website.isNotEmpty && - widget.business.website != "") - Column( - children: [ - MihButton( - width: 80, - height: 80, - onPressed: () { - _launchWebsite(widget.business.website); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Icon( - Icons.language, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - size: iconSize, - ), - ), - const SizedBox(height: 2), - FittedBox( - child: Text( - "Website", - style: TextStyle( - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - ), - ), - ), - ], - ), - FutureBuilder( - future: _businessReviewFuture, - builder: (context, asyncSnapshot) { - if (asyncSnapshot.connectionState == ConnectionState.waiting) { - return Column( - children: [ - MihButton( - width: 80, - height: 80, - onPressed: () {}, - buttonColor: MihColors.getGreyColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - child: Icon( - Icons.star_rate_rounded, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - size: iconSize, - ), - ).redacted(context: context, redact: true), - const SizedBox(height: 2), - FittedBox( - child: Text( - "Rate Us", - style: TextStyle( - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - ), - ).redacted(context: context, redact: true), - ), - ], - ); - } else { - BusinessReview? businessReview = asyncSnapshot.data; - String ratingTitle = ""; - if (businessReview == null) { - ratingTitle = "Rate Us"; - } else { - ratingTitle = "Edit"; - } - return Column( - children: [ - MihButton( - width: 80, - height: 80, - onPressed: () { - businessReviewRatingWindow(directoryProvider, - businessReview, true, widget.width); - }, - buttonColor: MihColors.getYellowColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - child: Icon( - Icons.star_rate_rounded, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - size: iconSize, - ), - ), - const SizedBox(height: 2), - FittedBox( - child: Text( - ratingTitle, - style: TextStyle( - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - ), - ), - ), - ], - ); - } - }, - ), - FutureBuilder( - future: _bookmarkedBusinessFuture, - builder: (context, asyncSnapshot) { - if (asyncSnapshot.connectionState == ConnectionState.waiting) { - return Column( - children: [ - MihButton( - width: 80, - height: 80, - onPressed: () {}, - buttonColor: MihColors.getGreyColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - child: Icon( - Icons.bookmark_add_rounded, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - size: iconSize, - ), - ).redacted(context: context, redact: true), - const SizedBox(height: 2), - FittedBox( - child: Text( - "bookmark", - style: TextStyle( - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - ), - ).redacted(context: context, redact: true), - ), - ], - ); - } else { - BookmarkedBusiness? bookmarkBusiness = asyncSnapshot.data; - String bookmarkDisplayTitle = ""; - if (bookmarkBusiness == null) { - bookmarkDisplayTitle = "Bookmark"; - } else { - bookmarkDisplayTitle = "Remove"; - } - return Column( - children: [ - MihButton( - width: 80, - height: 80, - onPressed: () { - if (bookmarkBusiness == null) { - showAddBookmarkAlert(); - } else { - showDeleteBookmarkAlert(bookmarkBusiness); - } - }, - buttonColor: MihColors.getBluishPurpleColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - child: Icon( - bookmarkBusiness == null - ? Icons.bookmark_add_rounded - : Icons.bookmark_remove_rounded, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - size: iconSize, - ), - ), - const SizedBox(height: 2), - FittedBox( - child: Text( - bookmarkDisplayTitle, - style: TextStyle( - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - ), - ), - ), - ], - ); - } - }, - ), - ], - ); - }, - ); - } - - Future businessReviewRatingWindow( - MzansiDirectoryProvider directoryProvider, - BusinessReview? myReview, - bool previouslyRated, - double width) async { - if (_isUserSignedIn) { - showDialog( - barrierDismissible: false, - context: context, - builder: (context) => MihReviewBusinessWindow( - business: widget.business, - businessReview: myReview, - screenWidth: width, - readOnly: false, - onSuccessDismissPressed: () async { - List? businessSearchResults = []; - businessSearchResults = await MihBusinessDetailsServices() - .searchBusinesses(directoryProvider.searchTerm, - directoryProvider.businessTypeFilter, context); - Map> busImagesUrl = {}; - Future businessLogoUrl; - for (var bus in businessSearchResults) { - businessLogoUrl = MihFileApi.getMinioFileUrl(bus.logo_path); - busImagesUrl[bus.business_id] = businessLogoUrl; - } - directoryProvider.setSearchedBusinesses( - searchedBusinesses: businessSearchResults, - businessesImagesUrl: busImagesUrl, - ); - setState(() { - _businessReviewFuture = getUserReview(); - }); - }, - ), - ); - } else { - showSignInRequiredAlert(); - } - } - - void showAddBookmarkAlert() { - if (_isUserSignedIn) { - showDialog( - barrierDismissible: false, - context: context, - builder: (context) => MihAddBookmarkAlert( - business: widget.business, - onSuccessDismissPressed: () async { - _bookmarkedBusinessFuture = getUserBookmark(); - }, - ), - ); - } else { - showSignInRequiredAlert(); - } - } - - void showDeleteBookmarkAlert(BookmarkedBusiness? bookmarkBusiness) { - if (_isUserSignedIn) { - showDialog( - barrierDismissible: false, - context: context, - builder: (context) => MihDeleteBookmarkAlert( - business: widget.business, - bookmarkBusiness: bookmarkBusiness, - onSuccessDismissPressed: () { - _bookmarkedBusinessFuture = getUserBookmark(); - }, - // startUpSearch: widget.startUpSearch, - )); - } else { - showSignInRequiredAlert(); - } - } - - void showSignInRequiredAlert() { - showDialog( - barrierDismissible: false, - context: context, - builder: (context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: () { - context.pop(); - }, - windowBody: Column( - children: [ - Icon( - MihIcons.mihLogo, - size: 125, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "Let's Get Started", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - Text( - "Ready to dive in to the world of MIH?\nSign in or create a free MIH account to unlock all the powerful features of the MIH app. It's quick and easy!", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 15, - ), - ), - const SizedBox(height: 25), - Center( - child: MihButton( - onPressed: () { - context.goNamed( - 'mihHome', - extra: true, - ); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Sign In/ Create Account", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_business_profile_preview.dart b/mih_ui/lib/mih_package_components/mih_business_profile_preview.dart deleted file mode 100644 index 0380688e..00000000 --- a/mih_ui/lib/mih_package_components/mih_business_profile_preview.dart +++ /dev/null @@ -1,117 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_location_services.dart'; -import 'package:provider/provider.dart'; - -class MihBusinessProfilePreview extends StatefulWidget { - final Business business; - final ImageProvider? imageFile; - final bool loading; - const MihBusinessProfilePreview({ - super.key, - required this.business, - required this.imageFile, - required this.loading, - }); - - @override - State createState() => - _MihBusinessProfilePreviewState(); -} - -class _MihBusinessProfilePreviewState extends State { - String calculateDistance(MzansiDirectoryProvider directoryProvider) { - try { - double distanceInKm = MIHLocationAPI().getDistanceInMeaters( - directoryProvider.userLocation, widget.business.gps_location) / - 1000; - return "${distanceInKm.toStringAsFixed(2)} km"; - } catch (error) { - print(error); - return "*.** km"; - } - } - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - double profilePictureWidth = 60; - return Consumer( - builder: (BuildContext context, MzansiDirectoryProvider directoryProvider, - Widget? child) { - return Row( - children: [ - widget.loading - ? Icon( - MihIcons.mihRing, - size: profilePictureWidth, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ) - : widget.imageFile == null - ? Icon( - MihIcons.iDontKnow, - size: profilePictureWidth, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ) - : MihCircleAvatar( - imageFile: widget.imageFile, - width: profilePictureWidth, - expandable: false, - editable: false, - fileNameController: TextEditingController(), - userSelectedfile: null, - frameColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onChange: () {}, - ), - const SizedBox(width: 15), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.business.Name, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18, - ), - ), - Text( - widget.business.type, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 15, - ), - ), - Text( - directoryProvider.userPosition != null - ? calculateDistance(directoryProvider) - : "0.00 km", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 10, - ), - ), - ], - ) - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_button.dart b/mih_ui/lib/mih_package_components/mih_button.dart deleted file mode 100644 index 6e76d55c..00000000 --- a/mih_ui/lib/mih_package_components/mih_button.dart +++ /dev/null @@ -1,68 +0,0 @@ -import 'package:flutter/material.dart'; - -class MihButton extends StatelessWidget { - final void Function()? onPressed; - final void Function()? onLongPressed; - final Color buttonColor; - final double? width; - final double? height; - final double? borderRadius; - final double? elevation; // 0 = flat, higher = more shadow - final Widget child; - - const MihButton({ - super.key, - required this.onPressed, - this.onLongPressed, - required this.buttonColor, - this.width, - this.height, - this.borderRadius, - this.elevation, - required this.child, - }); - Color _darkerColor(Color color, [double amount = .1]) { - final hsl = HSLColor.fromColor(color); - final hslDark = hsl.withLightness((hsl.lightness - amount).clamp(0.0, 1.0)); - return hslDark.toColor(); - } - - @override - Widget build(BuildContext context) { - final Color effectiveButtonColor = onPressed == null - ? buttonColor.withValues(alpha: 0.6) // Example disabled color - : buttonColor; - final Color rippleColor = _darkerColor(effectiveButtonColor, 0.1); - final double radius = borderRadius ?? 25.0; - final double effectiveElevation = - onPressed == null ? 0.0 : (elevation ?? 4.0); - return MouseRegion( - cursor: onPressed == null - ? SystemMouseCursors.basic - : SystemMouseCursors.click, - child: Material( - color: effectiveButtonColor, - borderRadius: BorderRadius.circular(radius), - elevation: effectiveElevation, - shadowColor: Colors.black, - child: InkWell( - borderRadius: BorderRadius.circular(radius), - splashColor: rippleColor, - highlightColor: rippleColor.withValues(alpha: 0.2), - hoverColor: rippleColor.withValues(alpha: 0.3), - onTap: onPressed, - onLongPress: onLongPressed, - child: Container( - width: width, - height: height, - padding: (width == null || height == null) - ? const EdgeInsets.symmetric(horizontal: 24, vertical: 12) - : null, - alignment: Alignment.center, - child: child, - ), - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_calendar.dart b/mih_ui/lib/mih_package_components/mih_calendar.dart deleted file mode 100644 index 4fcfd7c0..00000000 --- a/mih_ui/lib/mih_package_components/mih_calendar.dart +++ /dev/null @@ -1,117 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:provider/provider.dart'; -import 'package:table_calendar/table_calendar.dart'; - -class MIHCalendar extends StatefulWidget { - final double calendarWidth; - final double rowHeight; - final void Function(String) setDate; - const MIHCalendar({ - super.key, - required this.calendarWidth, - required this.rowHeight, - required this.setDate, - }); - - @override - State createState() => _MIHCalendarState(); -} - -class _MIHCalendarState extends State { - late DateTime selectedDay; - CalendarFormat _calendarFormat = CalendarFormat.week; - - void onDaySelected(DateTime day, DateTime focusedDay) { - KenLogger.success("Selected Day: $day"); - setState(() { - selectedDay = day; - }); - widget.setDate(selectedDay.toString().split(" ")[0]); - } - - @override - void initState() { - super.initState(); - MihCalendarProvider mihCalendarProvider = - context.read(); - if (mihCalendarProvider.selectedDay.isNotEmpty) { - selectedDay = DateTime.parse(mihCalendarProvider.selectedDay); - } else { - selectedDay = DateTime.now(); - } - } - - @override - Widget build(BuildContext context) { - return SizedBox( - width: widget.calendarWidth, - child: TableCalendar( - headerStyle: HeaderStyle( - formatButtonDecoration: BoxDecoration( - border: Border.fromBorderSide( - BorderSide( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - borderRadius: const BorderRadius.all( - Radius.circular(12.0), - ), - ), - // formatButtonTextStyle: - ), - rowHeight: widget.rowHeight, - focusedDay: selectedDay, - firstDay: DateTime.utc(2024, 1, 1), - lastDay: DateTime.utc(2099, 1, 1), - onDaySelected: onDaySelected, - selectedDayPredicate: (day) => isSameDay(day, selectedDay), - calendarFormat: _calendarFormat, - onFormatChanged: (format) { - setState(() { - _calendarFormat = format; - }); - }, - calendarStyle: CalendarStyle( - outsideDaysVisible: false, - todayTextStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - todayDecoration: BoxDecoration( - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - shape: BoxShape.circle, - ), - selectedTextStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - selectedDecoration: BoxDecoration( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - shape: BoxShape.circle, - ), - weekendTextStyle: TextStyle( - color: MihColors.getGreyColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - daysOfWeekStyle: DaysOfWeekStyle( - weekdayStyle: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - weekendStyle: TextStyle( - color: MihColors.getGreyColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_circle_avatar.dart b/mih_ui/lib/mih_package_components/mih_circle_avatar.dart deleted file mode 100644 index c3d4db1f..00000000 --- a/mih_ui/lib/mih_package_components/mih_circle_avatar.dart +++ /dev/null @@ -1,198 +0,0 @@ -import 'dart:io'; - -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; - -class MihCircleAvatar extends StatefulWidget { - final ImageProvider? imageFile; - final double width; - final bool expandable; - final bool editable; - final TextEditingController? fileNameController; - final onChange; - final PlatformFile? userSelectedfile; - final Color frameColor; - final Color? backgroundColor; - const MihCircleAvatar({ - super.key, - required this.imageFile, - required this.width, - required this.expandable, - required this.editable, - required this.fileNameController, - required this.userSelectedfile, - required this.frameColor, - required this.backgroundColor, - required this.onChange, - }); - - @override - State createState() => _MihCircleAvatarState(); -} - -class _MihCircleAvatarState extends State { - late ImageProvider? imagePreview; - - ImageProvider? getAvatar() { - if (widget.imageFile == null) { - return null; - } else { - return widget.imageFile; - } - } - - void expandAvatar() { - showDialog( - context: context, - builder: (context) { - return MihPackageWindow( - fullscreen: true, - windowTitle: "", - scrollbarOn: false, - onWindowTapClose: () { - context.pop(); - }, - windowBody: SizedBox.expand( - child: InteractiveViewer( - child: Image(image: imagePreview!), - ), - ), - ); - }); - } - - @override - void initState() { - super.initState(); - setState(() { - imagePreview = getAvatar(); - }); - } - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: widget.expandable - ? () { - KenLogger.success("Avatar tapped"); - expandAvatar(); - } - : null, - child: Container( - alignment: Alignment.center, - width: widget.width, - height: widget.width, - child: Stack( - alignment: Alignment.center, - children: [ - Visibility( - visible: imagePreview != null, - child: Positioned( - right: widget.width * 0.03, - child: CircleAvatar( - radius: widget.width / 2.2, - backgroundColor: widget.backgroundColor, - backgroundImage: imagePreview, - ), - ), - ), - Visibility( - visible: imagePreview != null, - child: Icon( - size: widget.width, - MihIcons.mihRing, - color: widget.frameColor, - ), - ), - Visibility( - visible: imagePreview == null, - child: Icon( - MihIcons.iDontKnow, - size: widget.width, - color: widget.frameColor, - ), - ), - Visibility( - visible: widget.editable, - child: Positioned( - bottom: 0, - right: 0, - child: IconButton.filled( - style: ButtonStyle( - backgroundColor: WidgetStateProperty.all( - MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - onPressed: () async { - try { - FilePickerResult? result = - await FilePicker.platform.pickFiles( - type: FileType.image, - ); - // print("Here 1"); - if (MzansiInnovationHub.of(context)! - .theme - .getPlatform() == - "Web") { - // print("Here 2"); - if (result == null) return; - // print("Here 3"); - PlatformFile? selectedFile = result.files.first; - setState(() { - // print("Here 4"); - widget.onChange(selectedFile); - // print("Here 5"); - imagePreview = MemoryImage(selectedFile.bytes!); - }); - - setState(() { - widget.fileNameController!.text = selectedFile.name; - }); - } else { - if (result != null) { - File file = File(result.files.single.path!); - PlatformFile? androidFile = PlatformFile( - path: file.path, - name: file.path.split('/').last, - size: file.lengthSync(), - bytes: await file.readAsBytes(), // Read file bytes - //extension: fileExtension, - ); - setState(() { - widget.onChange(androidFile); - imagePreview = FileImage(file); - }); - - setState(() { - widget.fileNameController!.text = - file.path.split('/').last; - }); - } else { - print("here in else"); - // User canceled the picker - } - } - } catch (e) { - print("Here Error: $e"); - } - }, - icon: Icon( - Icons.camera_alt, - ), - ), - ), - ), - ], - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_date_field.dart b/mih_ui/lib/mih_package_components/mih_date_field.dart deleted file mode 100644 index d1ad38f5..00000000 --- a/mih_ui/lib/mih_package_components/mih_date_field.dart +++ /dev/null @@ -1,207 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihDateField extends StatefulWidget { - final TextEditingController controller; - final String labelText; - final bool required; - final double? width; - final double? height; - final double? borderRadius; - final double? elevation; - final FormFieldValidator? validator; - const MihDateField({ - super.key, - required this.controller, - required this.labelText, - required this.required, - this.width, - this.height, - this.borderRadius, - this.elevation, - this.validator, - }); - - @override - State createState() => _MihDateFieldState(); -} - -class _MihDateFieldState extends State { - FormFieldState? _formFieldState; - - Future _selectDate(BuildContext context) async { - DateTime? picked = await showDatePicker( - context: context, - initialDate: widget.controller.text.isNotEmpty - ? DateTime.tryParse(widget.controller.text) ?? DateTime.now() - : DateTime.now(), - firstDate: DateTime(2000), - lastDate: DateTime(2100), - ); - if (picked != null) { - widget.controller.text = picked.toString().split(" ")[0]; - _formFieldState?.didChange(widget.controller.text); - setState(() {}); - } - } - - @override - Widget build(BuildContext context) { - return Center( - child: SizedBox( - width: widget.width, - height: widget.height, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - widget.labelText, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - if (!widget.required) - Text( - "(Optional)", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 15, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const SizedBox(height: 4), - FormField( - initialValue: widget.controller.text, - validator: widget.validator, - autovalidateMode: AutovalidateMode.onUserInteraction, - builder: (field) { - _formFieldState = field; - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Material( - elevation: widget.elevation ?? 4.0, - borderRadius: - BorderRadius.circular(widget.borderRadius ?? 8.0), - child: TextFormField( - controller: widget.controller, - readOnly: true, - onTap: () => _selectDate(context), - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.w500, - ), - decoration: InputDecoration( - suffixIcon: Icon( - Icons.calendar_today, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - errorStyle: const TextStyle(height: 0, fontSize: 0), - contentPadding: const EdgeInsets.symmetric( - horizontal: 10.0, vertical: 8.0), - filled: true, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular( - widget.borderRadius ?? 8.0), - borderSide: field.hasError - ? BorderSide( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - width: 2.0, - ) - : BorderSide.none, - ), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular( - widget.borderRadius ?? 8.0), - borderSide: BorderSide.none, - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular( - widget.borderRadius ?? 8.0), - borderSide: BorderSide( - color: field.hasError - ? MihColors.getRedColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark") - : MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - width: 3.0, - ), - ), - errorBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular( - widget.borderRadius ?? 8.0), - borderSide: BorderSide( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 3.0, - ), - ), - focusedErrorBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular( - widget.borderRadius ?? 8.0), - borderSide: BorderSide( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 3.0, - ), - ), - ), - onChanged: (value) { - field.didChange(value); - }, - ), - ), - if (field.hasError) - Padding( - padding: const EdgeInsets.only(left: 8.0, top: 4.0), - child: Text( - field.errorText ?? '', - style: TextStyle( - fontSize: 12, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ); - }, - ), - ], - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_dropdwn_field.dart b/mih_ui/lib/mih_package_components/mih_dropdwn_field.dart deleted file mode 100644 index 3ec6861f..00000000 --- a/mih_ui/lib/mih_package_components/mih_dropdwn_field.dart +++ /dev/null @@ -1,295 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihDropdownField extends StatefulWidget { - final TextEditingController controller; - final String hintText; - final bool requiredText; - final List dropdownOptions; - final bool editable; - final bool enableSearch; - final FormFieldValidator? validator; - final Function(String?)? onSelected; - - const MihDropdownField({ - super.key, - required this.controller, - required this.hintText, - required this.dropdownOptions, - required this.requiredText, - required this.editable, - required this.enableSearch, - this.validator, - this.onSelected, - }); - - @override - State createState() => _MihDropdownFieldState(); -} - -class _MihDropdownFieldState extends State { - late List> menu; - - List> buildMenuOptions(List options) { - List> menuList = []; - for (final i in options) { - menuList.add(DropdownMenuEntry( - value: i, - label: i, - style: ButtonStyle( - foregroundColor: WidgetStatePropertyAll(MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark")), - ), - )); - } - return menuList; - } - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - menu = buildMenuOptions(widget.dropdownOptions); - } - - @override - void initState() { - super.initState(); - menu = widget.dropdownOptions - .map((e) => DropdownMenuEntry(value: e, label: e)) - .toList(); - } - - @override - Widget build(BuildContext context) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - widget.hintText, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - if (!widget.requiredText) - Text( - "(Optional)", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 15, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const SizedBox(height: 4), - FormField( - validator: widget.validator, - autovalidateMode: AutovalidateMode.onUserInteraction, - initialValue: widget.controller.text, - builder: (field) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Expanded( - child: Theme( - data: Theme.of(context).copyWith( - scrollbarTheme: ScrollbarThemeData( - thumbColor: WidgetStatePropertyAll( - MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark")), - thickness: const WidgetStatePropertyAll(6), - radius: const Radius.circular(10), - thumbVisibility: const WidgetStatePropertyAll( - true), // Always show when scrolling - ), - textSelectionTheme: TextSelectionThemeData( - cursorColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - selectionColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark") - .withValues(alpha: 0.3), - selectionHandleColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - child: DropdownMenu( - controller: widget.controller, - dropdownMenuEntries: menu, - enableSearch: widget.enableSearch, - enableFilter: widget.enableSearch, - enabled: widget.editable, - textInputAction: widget.enableSearch - ? TextInputAction.search - : TextInputAction.none, - requestFocusOnTap: widget.enableSearch, - menuHeight: 400, - expandedInsets: EdgeInsets.zero, - textStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.w500, - ), - trailingIcon: Icon( - Icons.arrow_drop_down, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - selectedTrailingIcon: Icon( - Icons.arrow_drop_up, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - // leadingIcon: - // IconButton( - // onPressed: () { - // widget.controller.clear(); - // field.didChange(''); - // }, - // icon: Icon( - // Icons.delete_outline_rounded, - // color: MihColors.getPrimaryColor( - // MzansiInnovationHub.of(context)!.theme.mode == - // "Dark"), - // ), - // ), - onSelected: (String? selectedValue) { - field.didChange(selectedValue); - widget.onSelected?.call(selectedValue); - }, - menuStyle: MenuStyle( - backgroundColor: WidgetStatePropertyAll( - MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark")), - side: WidgetStatePropertyAll( - BorderSide( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - width: 1.0), - ), - shape: WidgetStatePropertyAll( - RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - 10), // Increase for more roundness - ), - ), - ), - inputDecorationTheme: InputDecorationTheme( - errorStyle: const TextStyle(height: 0, fontSize: 0), - contentPadding: const EdgeInsets.symmetric( - horizontal: 10.0, vertical: 8.0), - filled: true, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(8.0), - borderSide: BorderSide.none, - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(8.0), - borderSide: BorderSide( - color: field.hasError - ? MihColors.getRedColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark") - : MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - width: 3.0, - ), - ), - errorBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(8.0), - borderSide: BorderSide( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - width: 3.0, - ), - ), - focusedErrorBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(8.0), - borderSide: BorderSide( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - width: 3.0, - ), - ), - ), - ), - ), - ), - const SizedBox(width: 8), - GestureDetector( - onTap: () { - widget.controller.clear(); - field.didChange(''); - }, - child: Icon( - size: 35, - Icons.delete_rounded, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ], - ), - if (field.hasError) - Padding( - padding: const EdgeInsets.only(left: 8.0, top: 4.0), - child: Text( - field.errorText ?? '', - style: TextStyle( - fontSize: 12, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ); - }, - ), - ], - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_floating_menu.dart b/mih_ui/lib/mih_package_components/mih_floating_menu.dart deleted file mode 100644 index 5547d31e..00000000 --- a/mih_ui/lib/mih_package_components/mih_floating_menu.dart +++ /dev/null @@ -1,48 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihFloatingMenu extends StatefulWidget { - final IconData? icon; - final double? iconSize; - final AnimatedIconData? animatedIcon; - final SpeedDialDirection? direction; - final List children; - const MihFloatingMenu({ - super.key, - this.icon, - this.iconSize, - this.animatedIcon, - this.direction, - required this.children, - }); - - @override - State createState() => _MihFloatingMenuState(); -} - -class _MihFloatingMenuState extends State { - @override - Widget build(BuildContext context) { - return SpeedDial( - key: GlobalKey(), - icon: widget.icon, - buttonSize: Size(widget.iconSize ?? 56.0, widget.iconSize ?? 56.0), - animatedIcon: widget.animatedIcon, - direction: widget.direction ?? SpeedDialDirection.up, - activeIcon: Icons.close, - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - activeBackgroundColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - foregroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - overlayColor: Colors.black, - overlayOpacity: 0.5, - children: widget.children, - onOpen: () => debugPrint('OPENING DIAL'), - onClose: () => debugPrint('DIAL CLOSED'), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_form.dart b/mih_ui/lib/mih_package_components/mih_form.dart deleted file mode 100644 index 6c880b97..00000000 --- a/mih_ui/lib/mih_package_components/mih_form.dart +++ /dev/null @@ -1,27 +0,0 @@ -import 'package:flutter/material.dart'; - -class MihForm extends StatefulWidget { - final GlobalKey formKey; - final List formFields; - const MihForm({ - super.key, - required this.formKey, - required this.formFields, - }); - - @override - State createState() => _MihFormState(); -} - -class _MihFormState extends State { - @override - Widget build(BuildContext context) { - return Form( - key: widget.formKey, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: widget.formFields, - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_icons.dart b/mih_ui/lib/mih_package_components/mih_icons.dart deleted file mode 100644 index 6dbb19c8..00000000 --- a/mih_ui/lib/mih_package_components/mih_icons.dart +++ /dev/null @@ -1,67 +0,0 @@ -import 'package:flutter/widgets.dart'; // You need this import for IconData - -class MihIcons { - MihIcons._(); // This makes the class non-instantiable (good practice for utility classes) - - // This MUST match the 'family' name you specify in pubspec.yaml - static const _mihFontFam = 'MihIcons'; - // Set to your package name ONLY if this font is part of a separate package you created - static const String? _mihFontPkg = null; - -// IconData constants based on your style.css file - // Note: We convert the hex code from CSS (\eXXX) to an integer (0xeXXX) - - static const IconData mineSweeper = - IconData(0xe900, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData mzansiDirectory = - IconData(0xe901, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData personalProfile = - IconData(0xe902, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData aboutMih = - IconData(0xe903, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData accessControl = - IconData(0xe904, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData businessProfile = - IconData(0xe905, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData businessSetup = - IconData(0xe906, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData calculator = - IconData(0xe907, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData calendar = - IconData(0xe908, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData iDontKnow = - IconData(0xe909, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData mihLogo = - IconData(0xe90a, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData mihRing = - IconData(0xe90b, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData mzansiAi = - IconData(0xe90c, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData mzansiWallet = - IconData(0xe90d, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData notifications = - IconData(0xe90e, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData patientManager = - IconData(0xe90f, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData patientProfile = - IconData(0xe910, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); - - static const IconData profileSetup = - IconData(0xe911, fontFamily: _mihFontFam, fontPackage: _mihFontPkg); -} diff --git a/mih_ui/lib/mih_package_components/mih_image_display.dart b/mih_ui/lib/mih_package_components/mih_image_display.dart deleted file mode 100644 index 3197628d..00000000 --- a/mih_ui/lib/mih_package_components/mih_image_display.dart +++ /dev/null @@ -1,166 +0,0 @@ -import 'dart:io'; - -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/material.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihImageDisplay extends StatefulWidget { - final ImageProvider? imageFile; - final double width; - final double height; - final bool editable; - final TextEditingController fileNameController; - final onChange; - final PlatformFile? userSelectedfile; - const MihImageDisplay({ - super.key, - required this.imageFile, - required this.width, - required this.height, - required this.editable, - required this.fileNameController, - required this.userSelectedfile, - required this.onChange, - }); - - @override - State createState() => _MihImageDisplayState(); -} - -class _MihImageDisplayState extends State { - late ImageProvider? imagePreview; - - ImageProvider? getImage() { - KenLogger.success(widget.imageFile.toString()); - if (widget.imageFile == null) { - return null; - } else { - return widget.imageFile; - } - } - - @override - void initState() { - super.initState(); - setState(() { - imagePreview = getImage(); - }); - } - - @override - Widget build(BuildContext context) { - // if (widget.imageFile == null) - return Container( - // color: Colors.white, - alignment: Alignment.center, - width: widget.width, - height: widget.height, - child: Stack( - alignment: Alignment.center, - children: [ - imagePreview != null - ? ClipRRect( - borderRadius: BorderRadius.circular(widget.width * 0.1), - child: Container( - // width: widget.width, - height: widget.height, - decoration: BoxDecoration( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - borderRadius: BorderRadius.circular(widget.width * 0.1), - ), - child: Image(image: imagePreview!), - ), - ) - : Container( - width: widget.width, - height: widget.height, - decoration: BoxDecoration( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(widget.width * 0.1), - ), - child: Icon( - Icons.image_not_supported_rounded, - size: widget.width * 0.3, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - Visibility( - visible: widget.editable, - child: Positioned( - bottom: 5, - right: 5, - child: IconButton.filled( - style: IconButton.styleFrom( - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onPressed: () async { - try { - FilePickerResult? result = - await FilePicker.platform.pickFiles( - type: FileType.image, - ); - // print("Here 1"); - if (MzansiInnovationHub.of(context)!.theme.getPlatform() == - "Web") { - // print("Here 2"); - if (result == null) return; - // print("Here 3"); - PlatformFile? selectedFile = result.files.first; - setState(() { - // print("Here 4"); - widget.onChange(selectedFile); - // print("Here 5"); - imagePreview = MemoryImage(selectedFile.bytes!); - }); - - setState(() { - widget.fileNameController.text = selectedFile.name; - }); - } else { - if (result != null) { - File file = File(result.files.single.path!); - PlatformFile? androidFile = PlatformFile( - path: file.path, - name: file.path.split('/').last, - size: file.lengthSync(), - bytes: await file.readAsBytes(), // Read file bytes - //extension: fileExtension, - ); - setState(() { - widget.onChange(androidFile); - imagePreview = FileImage(file); - }); - - setState(() { - widget.fileNameController.text = - file.path.split('/').last; - }); - } else { - print("here in else"); - // User canceled the picker - } - } - } catch (e) { - print("here 2 Error: $e"); - } - }, - icon: const Icon( - Icons.edit, - ), - ), - ), - ), - ], - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_loading_circle.dart b/mih_ui/lib/mih_package_components/mih_loading_circle.dart deleted file mode 100644 index 576a425a..00000000 --- a/mih_ui/lib/mih_package_components/mih_loading_circle.dart +++ /dev/null @@ -1,97 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import '../main.dart'; - -class Mihloadingcircle extends StatefulWidget { - final String? message; - const Mihloadingcircle({ - super.key, - this.message, - }); - - @override - State createState() => _MihloadingcircleState(); -} - -class _MihloadingcircleState extends State - with SingleTickerProviderStateMixin { - late AnimationController _controller; - late Animation _animation; - - @override - void initState() { - super.initState(); - _controller = AnimationController( - duration: const Duration( - milliseconds: 500), // Duration for one pulse (grow and shrink) - vsync: this, - ); - _animation = Tween( - begin: 200, - end: 200 * 0.5, // Pulse to 50% of the initial size - ).animate(CurvedAnimation( - parent: _controller, - curve: Curves.easeInOut, // Smooth start and end of the pulse - )); - _controller.repeat(reverse: true); - } - - @override - void dispose() { - _controller.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Dialog( - child: IntrinsicWidth( - child: IntrinsicHeight( - child: Container( - padding: EdgeInsets.all(15), - decoration: BoxDecoration( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(25.0), - border: Border.all( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 5.0), - ), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - SizedBox( - width: 200, - height: 200, - child: AnimatedBuilder( - animation: _animation, - builder: (context, child) { - return Icon( - MihIcons.mihLogo, - size: _animation - .value, // The size changes based on the animation value - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ); - }, - ), - ), - if (widget.message != null) - Text( - widget.message!, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ], - )), - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_notification_drawer.dart b/mih_ui/lib/mih_package_components/mih_notification_drawer.dart deleted file mode 100644 index c11f6b1b..00000000 --- a/mih_ui/lib/mih_package_components/mih_notification_drawer.dart +++ /dev/null @@ -1,249 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_objects/arguments.dart'; -import 'package:mzansi_innovation_hub/mih_objects/notification.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class MIHNotificationDrawer extends StatefulWidget { - final AppUser signedInUser; - final List notifications; - //final ImageProvider? propicFile; - - const MIHNotificationDrawer({ - super.key, - required this.signedInUser, - required this.notifications, - }); - - @override - State createState() => _MIHNotificationDrawerState(); -} - -class _MIHNotificationDrawerState extends State { - late List> notificationList; - final baseAPI = AppEnviroment.baseApiUrl; - Future updateNotificationAPICall(int index) async { - var response = await http.put( - Uri.parse( - "$baseAPI/notifications/update/${widget.notifications[index].idnotifications}"), - ); - if (response.statusCode == 200) { - Navigator.of(context).pop(); - Navigator.of(context).pop(); - Navigator.of(context).pushNamed( - "/", - arguments: AuthArguments(true, false), - ); - Navigator.of(context).pushNamed( - widget.notifications[index].action_path, - arguments: widget.signedInUser, - ); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - List> setTempNofitications() { - List> temp = []; - temp.add(["Notification 1", "Notification Description 1"]); - temp.add(["Notification 2", "Notification Description 2"]); - temp.add(["Notification 3", "Notification Description 3"]); - temp.add(["Notification 4", "Notification Description 4"]); - temp.add(["Notification 5", "Notification Description 5"]); - temp.add(["Notification 6", "Notification Description 6"]); - temp.add(["Notification 7", "Notification Description 7"]); - temp.add(["Notification 8", "Notification Description 8"]); - temp.add(["Notification 9", "Notification Description 9"]); - temp.add(["Notification 10", "Notification Description 10"]); - return temp; - } - - Widget displayTempNotifications(int index) { - String title = notificationList[index][0]; - String subtitle = notificationList[index][1]; - return ListTile( - title: Text( - title, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - subtitle: Text( - subtitle, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - onTap: () {}, - ); - } - - Widget displayNotifications(int index) { - String title = widget.notifications[index].notification_type; - String subtitle = - "${widget.notifications[index].insert_date}\n${widget.notifications[index].notification_message}"; - Widget notificationTitle; - if (widget.notifications[index].notification_read == "No") { - notificationTitle = Row( - children: [ - Icon( - Icons.circle_notifications, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox( - width: 5, - ), - Flexible( - child: Text( - title, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ), - ], - ); - } else { - notificationTitle = Row( - children: [ - //const Icon(Icons.circle_notifications), - Flexible( - child: Text( - title, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ), - ], - ); - } - return ListTile( - title: notificationTitle, - subtitle: Text( - subtitle, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - onTap: () { - if (widget.notifications[index].notification_read == "No") { - updateNotificationAPICall(index); - } else { - Navigator.of(context).pushNamed( - widget.notifications[index].action_path, - arguments: widget.signedInUser, - ); - } - }, - ); - } - - Widget displayNotification() { - if (widget.notifications.isNotEmpty) { - return ListView.separated( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - separatorBuilder: (BuildContext context, index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemCount: widget.notifications.length, - itemBuilder: (context, index) { - //final patient = widget.patients[index].id_no.contains(widget.searchString); - //print(index); - return displayNotifications(index); - }, - ); - } else { - return const Padding( - padding: EdgeInsets.only(top: 35), - child: Text( - "No Notifications", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 20), - ), - ); - } - } - - @override - void dispose() { - super.dispose(); - } - - @override - void initState() { - setState(() { - notificationList = setTempNofitications(); - }); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return SafeArea( - child: Drawer( - //backgroundColor: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(5.0), - child: Text( - "Notifications", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ), - ], - ), - ), - displayNotification(), - // ListView.separated( - // shrinkWrap: true, - // physics: const NeverScrollableScrollPhysics(), - // separatorBuilder: (BuildContext context, index) { - // return Divider( - // color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ); - // }, - // itemCount: widget.notifications.length, - // itemBuilder: (context, index) { - // //final patient = widget.patients[index].id_no.contains(widget.searchString); - // //print(index); - // return displayNotifications(index); - // }, - // ), - ], - ), - )), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_notification_message.dart b/mih_ui/lib/mih_package_components/mih_notification_message.dart deleted file mode 100644 index 4df6b8a2..00000000 --- a/mih_ui/lib/mih_package_components/mih_notification_message.dart +++ /dev/null @@ -1,190 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import '../main.dart'; -import '../mih_objects/arguments.dart'; - -class MIHNotificationMessage extends StatefulWidget { - final NotificationArguments arguments; - const MIHNotificationMessage({ - super.key, - required this.arguments, - }); - - @override - State createState() => _MIHNotificationMessageState(); -} - -class _MIHNotificationMessageState extends State - with SingleTickerProviderStateMixin { - //var messageTypes = {}; - late AnimationController _animationController; - late Animation _scaleAnimation; - late double popUpWidth; - late double? popUpheight; - late double popUpTitleSize; - late double popUpSubtitleSize; - late double popUpBodySize; - late double popUpIconSize; - late double popUpPaddingSize; - late Color primary; - late Color secondary; - Size? size; - - void checkScreenSize() { - if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") { - setState(() { - popUpWidth = (size!.width / 4) * 2; - popUpheight = 90; - popUpTitleSize = 20.0; - popUpSubtitleSize = 20.0; - popUpBodySize = 15; - popUpPaddingSize = 25.0; - popUpIconSize = 100; - }); - } else { - setState(() { - popUpWidth = size!.width; - popUpheight = 90; - popUpTitleSize = 20.0; - popUpSubtitleSize = 18.0; - popUpBodySize = 15; - popUpPaddingSize = 5.0; - popUpIconSize = 100; - }); - } - } - - Widget notifyPopUp() { - return GestureDetector( - onTap: widget.arguments.onTap, - child: Container( - padding: - EdgeInsets.symmetric(vertical: 5, horizontal: popUpPaddingSize), - alignment: Alignment.topLeft, - width: popUpWidth, - height: popUpheight, - decoration: BoxDecoration( - color: primary, - borderRadius: BorderRadius.circular(25.0), - border: Border.all(color: secondary, width: 5.0), - ), - child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - //const SizedBox(height: 5), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.notifications, - color: secondary, - ), - const SizedBox(width: 10), - Flexible( - child: Text( - widget.arguments.title, - textAlign: TextAlign.center, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: secondary, - fontSize: popUpTitleSize, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - const SizedBox(height: 5), - Wrap( - alignment: WrapAlignment.start, - children: [ - SizedBox( - width: popUpWidth, - child: Text( - widget.arguments.body, - textAlign: TextAlign.left, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: secondary, - fontSize: popUpBodySize, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ], - ), - ), - ); - } - - @override - void dispose() { - _animationController.dispose(); - super.dispose(); - } - - @override - void initState() { - super.initState(); - setState(() { - primary = MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - secondary = MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - }); - _animationController = AnimationController( - vsync: this, - duration: - const Duration(milliseconds: 300), // Adjust the duration as needed - ); - - _scaleAnimation = Tween( - begin: const Offset(0, -1), - end: Offset.zero, - ).animate(_animationController); - - // Start the animation when - // the dialog is displayed - _animationController.forward(); - } - - @override - Widget build(BuildContext context) { - size = MediaQuery.of(context).size; - checkScreenSize(); - //setInputError(); - - //print(size); - // setState(() { - // width = size.width; - // height = size.height; - // }); - return SlideTransition( - position: _scaleAnimation, - child: Dialog( - insetPadding: const EdgeInsets.only( - top: 45, - left: 5, - right: 5, - ), - shadowColor: secondary, - alignment: Alignment.topCenter, - child: notifyPopUp(), - ), - ); - // return SlideTransition( - // position: Tween( - // begin: const Offset(0, -1), - // end: Offset.zero, - // ).animate(widget.animationController), - // child: Dialog( - // alignment: Alignment.topCenter, - // child: NotifyPopUp(), - // ), - // ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_numeric_stepper.dart b/mih_ui/lib/mih_package_components/mih_numeric_stepper.dart deleted file mode 100644 index 9e836b25..00000000 --- a/mih_ui/lib/mih_package_components/mih_numeric_stepper.dart +++ /dev/null @@ -1,238 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; - -class MihNumericStepper extends StatefulWidget { - final TextEditingController controller; - final Color fillColor; - final Color inputColor; - final String hintText; - final bool requiredText; - final double? width; - final int? minValue; - final int? maxValue; - final bool validationOn; - const MihNumericStepper({ - super.key, - required this.controller, - required this.fillColor, - required this.inputColor, - required this.hintText, - required this.requiredText, - this.width, - this.minValue, - this.maxValue, - required this.validationOn, - }); - - @override - State createState() => _MihNumericStepperState(); -} - -class _MihNumericStepperState extends State { - late int _currentValue; - late bool error; - - @override - void dispose() { - widget.controller.removeListener(_syncCurrentValue); - super.dispose(); - } - - @override - void initState() { - super.initState(); - _currentValue = - int.tryParse(widget.controller.text) ?? widget.minValue ?? 0; - widget.controller.text = _currentValue.toString(); - int.tryParse(widget.controller.text) ?? widget.minValue ?? 0; - widget.controller.addListener(_syncCurrentValue); - // print("Current Value: $_currentValue"); - } - - void _syncCurrentValue() { - final newValue = - int.tryParse(widget.controller.text) ?? widget.minValue ?? 0; - if (newValue != _currentValue) { - setState(() { - _currentValue = newValue; - }); - } - } - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Row( - children: [ - Text( - widget.hintText, - style: TextStyle( - fontWeight: FontWeight.bold, - color: widget.fillColor, - fontSize: 18, - ), - ), - ], - ), - const SizedBox(height: 4), - Row( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Column( - children: [ - Container( - // color: Colors.white, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular( - 25), // Optional: rounds the corners - boxShadow: const [ - BoxShadow( - color: Color.fromARGB(60, 0, 0, - 0), // 0.2 opacity = 51 in alpha (255 * 0.2) - spreadRadius: -2, - blurRadius: 10, - offset: Offset(0, 5), - ), - ], - ), - child: Padding( - padding: const EdgeInsets.only( - top: 2.0, - left: 5.0, - ), - child: SizedBox( - width: 40, - child: IconButton.filled( - style: ButtonStyle( - backgroundColor: WidgetStateProperty.all( - MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark")), - ), - color: widget.inputColor, - iconSize: 20, - onPressed: () { - print("Current Value: $_currentValue"); - if (_currentValue >= (widget.minValue ?? 0)) { - setState(() { - widget.controller.text = - (_currentValue - 1).toString(); - _currentValue = - int.tryParse(widget.controller.text)!; - }); - } - print("New Current Value: $_currentValue"); - }, - icon: const Icon( - Icons.remove, - ), - ), - ), - ), - ), - Visibility( - visible: _currentValue < (widget.minValue ?? 0) || - (widget.maxValue != null && - _currentValue > widget.maxValue!), - child: const SizedBox( - height: 21, - ), - ), - ], - ), - const SizedBox(width: 15), - Expanded( - child: MihTextFormField( - width: widget.width, - fillColor: widget.fillColor, - inputColor: widget.inputColor, - controller: widget.controller, - hintText: null, - requiredText: widget.requiredText, - readOnly: true, - numberMode: true, - textIputAlignment: TextAlign.center, - validator: (value) { - if (widget.validationOn) { - return MihValidationServices().validateNumber( - value, widget.minValue, widget.maxValue); - } - return null; - }, - ), - ), - const SizedBox(width: 10), - Column( - children: [ - Container( - // color: Colors.white, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular( - 25), // Optional: rounds the corners - boxShadow: const [ - BoxShadow( - color: Color.fromARGB(60, 0, 0, - 0), // 0.2 opacity = 51 in alpha (255 * 0.2) - spreadRadius: -2, - blurRadius: 10, - offset: Offset(0, 5), - ), - ], - ), - child: Padding( - padding: const EdgeInsets.only( - top: 2.0, - left: 5.0, - ), - child: SizedBox( - width: 40, - child: IconButton.filled( - style: ButtonStyle( - backgroundColor: WidgetStateProperty.all( - MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark")), - ), - color: widget.inputColor, - iconSize: 20, - onPressed: () { - print("Current Value: $_currentValue"); - if (widget.maxValue == null || - _currentValue <= widget.maxValue!) { - setState(() { - widget.controller.text = - (_currentValue + 1).toString(); - _currentValue = - int.tryParse(widget.controller.text)!; - }); - } - print("New Current Value: $_currentValue"); - }, - icon: const Icon( - Icons.add, - ), - ), - ), - ), - ), - Visibility( - visible: _currentValue < (widget.minValue ?? 0) || - (widget.maxValue != null && - _currentValue > widget.maxValue!), - child: const SizedBox( - height: 21, - ), - ), - ], - ), - ], - ), - ], - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_package.dart b/mih_ui/lib/mih_package_components/mih_package.dart deleted file mode 100644 index d491b80e..00000000 --- a/mih_ui/lib/mih_package_components/mih_package.dart +++ /dev/null @@ -1,219 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/services.dart'; -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_scack_bar.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mih_home/components/mih_app_drawer.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:flutter/material.dart'; - -class MihPackage extends StatefulWidget { - final Widget appActionButton; - final MihPackageTools appTools; - final List appBody; - final List appToolTitles; - final MIHAppDrawer? actionDrawer; - final int selectedbodyIndex; - final Function(int) onIndexChange; - const MihPackage({ - super.key, - required this.appActionButton, - required this.appTools, - required this.appBody, - required this.appToolTitles, - this.actionDrawer, - required this.selectedbodyIndex, - required this.onIndexChange, - }); - - @override - State createState() => _MihPackageState(); -} - -class _MihPackageState extends State - with SingleTickerProviderStateMixin { - late int _currentIndex; - late PageController _pageController; - late AnimationController _animationController; - DateTime? lastPressedAt; - - void unfocusAll() { - FocusScope.of(context).unfocus(); - } - - Future _peakAnimation() async { - int currentPage = _currentIndex; - double peakOffset = _pageController.position.viewportDimension * 0.075; - double currentOffset = - _pageController.page! * _pageController.position.viewportDimension; - int nextPage = - currentPage + 1 < widget.appBody.length ? currentPage + 1 : currentPage; - if (nextPage != currentPage) { - await Future.delayed(const Duration(milliseconds: 100)); - await _pageController.animateTo( - currentOffset + peakOffset, - duration: const Duration(milliseconds: 300), - curve: Curves.easeOut, - ); - // await Future.delayed(const Duration(milliseconds: 100)); - await _pageController.animateTo( - currentPage * _pageController.position.viewportDimension, - duration: const Duration(milliseconds: 300), - curve: Curves.easeIn, - ); - } - } - - @override - void dispose() { - _pageController.dispose(); - _animationController.dispose(); - super.dispose(); - } - - @override - void didUpdateWidget(covariant MihPackage oldWidget) { - super.didUpdateWidget(oldWidget); - if (oldWidget.selectedbodyIndex != widget.selectedbodyIndex && - _currentIndex != widget.selectedbodyIndex) { - _currentIndex = widget.selectedbodyIndex; - _pageController.animateToPage( - widget.selectedbodyIndex, - duration: const Duration(milliseconds: 300), - curve: Curves.easeInOut, - ); - } - } - - @override - void initState() { - super.initState(); - _currentIndex = widget.selectedbodyIndex; - _pageController = PageController(initialPage: widget.selectedbodyIndex); - _animationController = AnimationController( - vsync: this, - duration: const Duration(milliseconds: 400), - ); - // if (!MzansiInnovationHub.of(context)!.theme.kIsWeb) { - // // Trigger the peak animation on start (or call this elsewhere) - // WidgetsBinding.instance.addPostFrameCallback((_) { - // _peakAnimation(); - // }); - // } - if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) { - // Trigger the peak animation only AFTER the route transition is complete - WidgetsBinding.instance.addPostFrameCallback((_) { - final ModalRoute? currentRoute = ModalRoute.of(context); - if (currentRoute != null) { - currentRoute.animation?.addStatusListener((status) { - if (status == AnimationStatus.completed && mounted) { - // Ensure the widget is still mounted and the animation is completed - _peakAnimation(); - } - }); - } - }); - } - } - - @override - Widget build(BuildContext context) { - Size screenSize = MediaQuery.of(context).size; - return GestureDetector( - onTap: unfocusAll, - child: PopScope( - canPop: false, - onPopInvokedWithResult: (bool didPop, Object? result) { - if (GoRouterState.of(context).name == 'mihHome' || - GoRouterState.of(context).name == 'mihAuthentication') { - if (lastPressedAt == null || - DateTime.now().difference(lastPressedAt!) > - const Duration(seconds: 2)) { - // First press: show a message and update the timestamp. - lastPressedAt = DateTime.now(); - ScaffoldMessenger.of(context).showSnackBar( - MihSnackBar( - child: Text("Press back again to exit"), - ), - ); - } else { - // Second press within 2 seconds: exit the app. - KenLogger.warning('Exiting app...'); // Your custom logger - SystemChannels.platform.invokeMethod('SystemNavigator.pop'); - } - } else { - context.goNamed( - 'mihHome', - extra: true, - ); - } - }, - child: Scaffold( - drawer: widget.actionDrawer, - body: SafeArea( - bottom: false, - minimum: EdgeInsets.only(bottom: 0), - child: Container( - width: screenSize.width, - height: screenSize.height, - //color: Colors.black, - padding: const EdgeInsets.only(top: 5), - child: Column( - children: [ - Row( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - widget.appActionButton, - const SizedBox( - width: 10, - ), - Expanded( - child: Container( - // alignment: Alignment.center, - // alignment: Alignment.centerRight, - alignment: Alignment.centerLeft, - // color: Colors.black, - child: FittedBox( - child: Text( - widget.appToolTitles[_currentIndex], - style: const TextStyle( - fontSize: 23, - fontWeight: FontWeight.w600, - ), - ), - ), - ), - ), - const SizedBox(width: 5), - widget.appTools, - const SizedBox(width: 5), - ], - ), - const SizedBox(height: 5), - Expanded( - child: PageView.builder( - controller: _pageController, - itemCount: widget.appBody.length, - itemBuilder: (context, index) { - return widget.appBody[index]; - }, - onPageChanged: (index) { - setState(() { - _currentIndex = index; - }); - widget.onIndexChange(index); - }, - ), - ), - ], - ), - ), - ), - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_package_action.dart b/mih_ui/lib/mih_package_components/mih_package_action.dart deleted file mode 100644 index 07db5d15..00000000 --- a/mih_ui/lib/mih_package_components/mih_package_action.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'package:flutter/material.dart'; - -class MihPackageAction extends StatefulWidget { - final void Function()? onTap; - final double iconSize; - final Widget icon; - const MihPackageAction({ - super.key, - required this.icon, - required this.iconSize, - required this.onTap, - }); - - @override - State createState() => _MihPackageActionState(); -} - -class _MihPackageActionState extends State { - @override - void dispose() { - super.dispose(); - } - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return IconButton( - iconSize: widget.iconSize, - padding: const EdgeInsets.all(0), - onPressed: widget.onTap, - icon: widget.icon, - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_package_tile.dart b/mih_ui/lib/mih_package_components/mih_package_tile.dart deleted file mode 100644 index e5d25f35..00000000 --- a/mih_ui/lib/mih_package_components/mih_package_tile.dart +++ /dev/null @@ -1,214 +0,0 @@ -import 'dart:io'; - -import 'package:app_settings/app_settings.dart'; -import 'package:flutter/foundation.dart'; -import 'package:local_auth/local_auth.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_yt_video_player.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; - -class MihPackageTile extends StatefulWidget { - final String appName; - final String? ytVideoID; - final Widget appIcon; - final void Function() onTap; - final double iconSize; - final Color textColor; - final bool? authenticateUser; - const MihPackageTile({ - super.key, - required this.onTap, - required this.appName, - this.ytVideoID, - required this.appIcon, - required this.iconSize, - required this.textColor, - this.authenticateUser, - }); - - @override - State createState() => _MihPackageTileState(); -} - -class _MihPackageTileState extends State { - final LocalAuthentication _auth = LocalAuthentication(); - - void displayHint() { - if (widget.ytVideoID != null) { - showDialog( - barrierDismissible: false, - context: context, - builder: (context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: widget.appName, - // windowTools: const [], - onWindowTapClose: () { - Navigator.pop(context); - }, - windowBody: MIHYTVideoPlayer( - videoYTLink: widget.ytVideoID!, - ), - ); - }, - ); - } - } - - Future isUserAuthenticated() async { - final bool canAuthWithBio = await _auth.canCheckBiometrics; - final bool canAuthenticate = - canAuthWithBio || await _auth.isDeviceSupported(); - print("Auth Available: $canAuthenticate"); - if (canAuthenticate) { - try { - final bool didBioAuth = await _auth.authenticate( - localizedReason: "Authenticate to access ${widget.appName}", - options: const AuthenticationOptions( - biometricOnly: false, - ), - ); - if (didBioAuth) { - return true; - } else { - authErrorPopUp(); - } - // print("Authenticated: $didBioAuth"); - } catch (error) { - print("Auth Error: $error"); - authErrorPopUp(); - } - } else { - print("Auth Error: No Biometrics Available"); - authErrorPopUp(); - } - return false; - } - - void authErrorPopUp() { - MihAlertServices().errorAdvancedAlert( - "Biometric Authentication Required", - "Hi there! To jump into the ${widget.appName} Package, you'll need to authenticate yourself with your devices biometrics, please set up biometric authentication (like fingerprint, face ID, pattern or pin) on your device first.\n\nIf you have already set up biometric authentication, press \"Authenticate now\" to try again or press \"Set Up Authentication\" to go to your device settings.", - [ - MihButton( - onPressed: () { - Navigator.of(context).pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - AppSettings.openAppSettings( - type: AppSettingsType.security, - ); - Navigator.of(context).pop(); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Set Up Authentication", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - Navigator.of(context).pop(); - authenticateUser(); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Authenticate Now", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - Future authenticateUser() async { - if (widget.authenticateUser != null && - widget.authenticateUser! && - !kIsWeb && - !Platform.isLinux) { - if (await isUserAuthenticated()) { - widget.onTap(); - } - } else { - widget.onTap(); - } - } - - @override - Widget build(BuildContext context) { - return Container( - alignment: Alignment.topCenter, - // color: Colors.black, - width: widget.iconSize, - height: widget.iconSize, - child: GestureDetector( - onTap: () async { - authenticateUser(); - }, - onLongPress: null, // Do this later - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: FittedBox( - fit: BoxFit.contain, - alignment: Alignment.center, - child: widget.appIcon, - ), - ), - const SizedBox(height: 10), - Padding( - // Add a little padding for better visual spacing - padding: const EdgeInsets.symmetric(horizontal: 4.0), - child: FittedBox( - child: Text( - widget.appName, - textAlign: TextAlign.center, // This centers the text content - maxLines: 1, // Allow up to 2 lines to prevent clipping - style: TextStyle( - color: widget.textColor, - fontSize: 20.0, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_package_tool_body.dart b/mih_ui/lib/mih_package_components/mih_package_tool_body.dart deleted file mode 100644 index 7b8470d7..00000000 --- a/mih_ui/lib/mih_package_components/mih_package_tool_body.dart +++ /dev/null @@ -1,95 +0,0 @@ -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihPackageToolBody extends StatefulWidget { - final bool borderOn; - final Widget bodyItem; - final double? innerHorizontalPadding; - const MihPackageToolBody({ - super.key, - required this.borderOn, - required this.bodyItem, - this.innerHorizontalPadding, - }); - - @override - State createState() => _MihPackageToolBodyState(); -} - -class _MihPackageToolBodyState extends State { - late double _innerBodyPadding; - double getHorizontalPaddingSize(Size screenSize) { - if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") { - if (widget.borderOn) { - return widget.innerHorizontalPadding ?? 10; - } else { - return widget.innerHorizontalPadding ?? 0; - } - } else { - // mobile - if (widget.borderOn) { - return widget.innerHorizontalPadding ?? 10; - } else { - return widget.innerHorizontalPadding ?? 0; - } - } - } - - double getVerticalPaddingSize(Size screenSize) { - // mobile - if (widget.borderOn) { - return 10; - } else { - return 0; - } - } - - Decoration? getBoader() { - if (widget.borderOn) { - _innerBodyPadding = 10.0; - return BoxDecoration( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(25.0), - border: Border.all( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 3.0), - ); - } else { - _innerBodyPadding = 0.0; - return BoxDecoration( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(25.0), - border: Border.all( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 3.0), - ); - } - } - - @override - Widget build(BuildContext context) { - Size screenSize = MediaQuery.sizeOf(context); - - return Padding( - padding: EdgeInsets.only( - left: getHorizontalPaddingSize(screenSize), - right: getHorizontalPaddingSize(screenSize), - bottom: getVerticalPaddingSize(screenSize), - top: 0, - ), - child: Container( - height: screenSize.height, - decoration: getBoader(), - child: Padding( - padding: EdgeInsets.all(_innerBodyPadding), - child: widget.bodyItem, - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_package_tools.dart b/mih_ui/lib/mih_package_components/mih_package_tools.dart deleted file mode 100644 index 4a4abddd..00000000 --- a/mih_ui/lib/mih_package_components/mih_package_tools.dart +++ /dev/null @@ -1,52 +0,0 @@ -import 'package:flutter/material.dart'; - -// ignore: must_be_immutable -class MihPackageTools extends StatefulWidget { - final Map tools; - int selcetedIndex; - MihPackageTools({ - super.key, - required this.tools, - required this.selcetedIndex, - }); - - @override - State createState() => _MihPackageToolsState(); -} - -class _MihPackageToolsState extends State { - List getTools() { - List temp = []; - int index = 0; - widget.tools.forEach((icon, onTap) { - temp.add( - Visibility( - visible: widget.selcetedIndex != index, - child: IconButton( - onPressed: onTap, - icon: icon, - ), - ), - ); - temp.add( - Visibility( - visible: widget.selcetedIndex == index, - child: IconButton.filled( - onPressed: onTap, - icon: icon, - ), - ), - ); - index += 1; - }); - return temp; - } - - @override - Widget build(BuildContext context) { - return Row( - mainAxisAlignment: MainAxisAlignment.end, - children: getTools(), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_package_window.dart b/mih_ui/lib/mih_package_components/mih_package_window.dart deleted file mode 100644 index 77f6a855..00000000 --- a/mih_ui/lib/mih_package_components/mih_package_window.dart +++ /dev/null @@ -1,221 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihPackageWindow extends StatefulWidget { - final String? windowTitle; - final Widget windowBody; - final List? menuOptions; - final void Function()? onWindowTapClose; - final Color? backgroundColor; - final Color? foregroundColor; - final bool? borderOn; - final bool fullscreen; - final bool? scrollbarOn; - const MihPackageWindow({ - super.key, - required this.fullscreen, - required this.windowTitle, - this.menuOptions, - required this.onWindowTapClose, - required this.windowBody, - this.borderOn, - this.scrollbarOn, - this.backgroundColor, - this.foregroundColor, - }); - - @override - State createState() => _MihPackageWindowState(); -} - -class _MihPackageWindowState extends State { - late double windowTitleSize; - late double horizontralWindowPadding; - late double vertticalWindowPadding; - late double windowWidth; - late double windowHeight; - late double width; - late double height; - - void checkScreenSize() { - // print("screen width: $width"); - // print("screen height: $height"); - if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") { - setState(() { - windowTitleSize = 25; - horizontralWindowPadding = width / 7; - vertticalWindowPadding = 10; - windowWidth = width; - windowHeight = height; - }); - } else { - setState(() { - windowTitleSize = 20; - horizontralWindowPadding = 10; - vertticalWindowPadding = 10; - windowWidth = width; - windowHeight = height; - }); - } - } - - Widget getHeader() { - return Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - if (widget.onWindowTapClose != null) - Padding( - padding: const EdgeInsets.only( - top: 5.0, - left: 5.0, - ), - child: MihButton( - width: 40, - height: 40, - elevation: 10, - onPressed: widget.onWindowTapClose, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Icon( - Icons.close, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ), - if (widget.windowTitle != null) - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Text( - widget.windowTitle!, - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: windowTitleSize, - fontWeight: FontWeight.bold, - color: widget.foregroundColor ?? - MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - ), - if (widget.menuOptions != null) - Padding( - padding: const EdgeInsets.only( - top: 5.0, - right: 5.0, - ), - child: SizedBox( - width: 40, - child: MihFloatingMenu( - iconSize: 40, - animatedIcon: AnimatedIcons.menu_close, - direction: SpeedDialDirection.down, - children: widget.menuOptions != null ? widget.menuOptions! : [], - ), - ), - ), - ], - ); - } - - @override - void dispose() { - super.dispose(); - } - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - var size = MediaQuery.of(context).size; - setState(() { - width = size.width; - height = size.height; - }); - checkScreenSize(); - return Dialog( - insetPadding: EdgeInsets.symmetric( - horizontal: horizontralWindowPadding, - vertical: vertticalWindowPadding, - ), - insetAnimationCurve: Easing.emphasizedDecelerate, - insetAnimationDuration: Durations.short1, - child: Material( - elevation: 10, - shadowColor: Colors.black, - color: widget.backgroundColor ?? - MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(25.0), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - border: widget.borderOn == null || !widget.borderOn! - ? null - : Border.all( - color: widget.foregroundColor ?? - MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 5.0), - ), - child: widget.fullscreen - ? Column( - mainAxisSize: MainAxisSize.max, - children: [ - getHeader(), - const SizedBox(height: 5), - Expanded( - child: widget.scrollbarOn != null || !widget.scrollbarOn! - ? widget.windowBody - : MihSingleChildScroll( - scrollbarOn: true, - child: widget.windowBody, - ), - ), - ], - ) - : Column( - mainAxisSize: MainAxisSize.min, - children: [ - getHeader(), - const SizedBox(height: 5), - Flexible( - child: Padding( - padding: EdgeInsets.only( - left: 25, - right: 25, - bottom: vertticalWindowPadding, - ), - child: ConstrainedBox( - constraints: BoxConstraints( - maxHeight: windowHeight * 0.85, - maxWidth: windowWidth * 0.85, - ), - child: MihSingleChildScroll( - scrollbarOn: true, - child: widget.windowBody, - ), - ), - ), - ), - ], - ), - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_personal_profile_preview.dart b/mih_ui/lib/mih_package_components/mih_personal_profile_preview.dart deleted file mode 100644 index daf313af..00000000 --- a/mih_ui/lib/mih_package_components/mih_personal_profile_preview.dart +++ /dev/null @@ -1,96 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; - -class MihPersonalProfilePreview extends StatefulWidget { - final AppUser user; - final ImageProvider? imageFile; - final bool loading; - const MihPersonalProfilePreview({ - super.key, - required this.user, - required this.imageFile, - required this.loading, - }); - - @override - State createState() => - _MihPersonalProfilePreviewState(); -} - -class _MihPersonalProfilePreviewState extends State { - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - double profilePictureWidth = 60; - return Row( - children: [ - widget.loading - ? Icon( - MihIcons.mihRing, - size: profilePictureWidth, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ) - : widget.imageFile == null - ? Icon( - MihIcons.iDontKnow, - size: profilePictureWidth, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ) - : MihCircleAvatar( - imageFile: widget.imageFile, - width: profilePictureWidth, - expandable: false, - editable: false, - fileNameController: TextEditingController(), - userSelectedfile: null, - frameColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onChange: () {}, - ), - const SizedBox(width: 15), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.user.username.isNotEmpty - ? widget.user.username - : "Username", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18, - ), - ), - Text( - widget.user.fname.isNotEmpty - ? "${widget.user.fname} ${widget.user.lname}" - : "Name Surname", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 15, - ), - ), - Text( - widget.user.type.toUpperCase(), - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 10, - ), - ), - ], - ) - ], - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_profile_links.dart b/mih_ui/lib/mih_package_components/mih_profile_links.dart deleted file mode 100644 index 756edfe1..00000000 --- a/mih_ui/lib/mih_package_components/mih_profile_links.dart +++ /dev/null @@ -1,159 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_objects/profile_link.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:provider/provider.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class MihProfileLinks extends StatefulWidget { - final List links; - final bool? paddingOn; - const MihProfileLinks({ - super.key, - required this.links, - this.paddingOn, - }); - - @override - State createState() => _MihProfileLinksState(); -} - -class _MihProfileLinksState extends State { - Widget displayLinkButton(ProfileLink link) { - IconData iconData; - Color btnColor; - Color iconColor = Colors.white; - switch (link.destination.toLowerCase()) { - case "youtube": - iconData = FontAwesomeIcons.youtube; - btnColor = const Color(0xFFFF0000); - break; - case "tiktok": - iconData = FontAwesomeIcons.tiktok; - btnColor = const Color(0xFF000000); - break; - case "twitch": - iconData = FontAwesomeIcons.twitch; - btnColor = const Color(0xFF6441a5); - break; - case "threads": - iconData = FontAwesomeIcons.threads; - btnColor = const Color(0xFF000000); - break; - case "whatsapp": - iconData = FontAwesomeIcons.whatsapp; - btnColor = const Color(0xFF25D366); - break; - case "instagram": - iconData = FontAwesomeIcons.instagram; - btnColor = const Color(0xFFF56040); - break; - case "x": - iconData = FontAwesomeIcons.xTwitter; - btnColor = const Color(0xFF000000); - break; - case "linkedin": - iconData = FontAwesomeIcons.linkedin; - btnColor = const Color(0xFF0a66c2); - break; - case "facebook": - iconData = FontAwesomeIcons.facebook; - btnColor = const Color(0xFF4267B2); - break; - case "reddit": - iconData = FontAwesomeIcons.reddit; - btnColor = const Color(0xFFFF4500); - break; - case "discord": - iconData = FontAwesomeIcons.discord; - btnColor = const Color(0xFF5865F2); - break; - case "git": - iconData = FontAwesomeIcons.git; - btnColor = const Color(0xFF73A952); - break; - default: - iconData = FontAwesomeIcons.link; - btnColor = MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } - return MihButton( - width: 80, - height: 80, - onPressed: () { - launchSocialUrl(Uri.parse(link.web_link)); - }, - buttonColor: btnColor, - child: FaIcon( - iconData, - color: iconColor, - size: 40, - ), - ); - // return MihPackageTile( - // onTap: () { - // launchSocialUrl(Uri.parse(link.web_link)); - // }, - // appName: link.destination, - // appIcon: Icon( - // iconData, - // color: btnColor, - // ), - // iconSize: 200, - // textColor: Colors.black, - // // MihColors.getPrimaryColor( - // // MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ); - } - - Future launchSocialUrl(Uri linkUrl) async { - if (!await launchUrl(linkUrl)) { - throw Exception('Could not launch $linkUrl'); - } - } - - @override - Widget build(BuildContext context) { - double width = MediaQuery.of(context).size.width; - return Consumer( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - Widget? child) { - return Padding( - padding: widget.paddingOn == null || widget.paddingOn! - ? MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0) - : EdgeInsetsGeometry.all(0), - child: widget.links.isEmpty - ? SizedBox( - height: 35, - child: Text( - "No Profile Links", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ) - : Wrap( - alignment: WrapAlignment.center, - runSpacing: 10, - spacing: 10, - children: widget.links.map( - (link) { - return displayLinkButton(link); - }, - ).toList(), - ), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_radio_options.dart b/mih_ui/lib/mih_package_components/mih_radio_options.dart deleted file mode 100644 index 5f7dfa40..00000000 --- a/mih_ui/lib/mih_package_components/mih_radio_options.dart +++ /dev/null @@ -1,140 +0,0 @@ -import 'package:flutter/material.dart'; - -class MihRadioOptions extends StatefulWidget { - final TextEditingController controller; - final String hintText; - final Color fillColor; - final Color secondaryFillColor; - final bool requiredText; - final List radioOptions; - const MihRadioOptions({ - super.key, - required this.controller, - required this.hintText, - required this.fillColor, - required this.secondaryFillColor, - required this.requiredText, - required this.radioOptions, - }); - - @override - State createState() => _MihRadioOptionsState(); -} - -class _MihRadioOptionsState extends State { - // late String _currentSelection; - - @override - void initState() { - super.initState(); - if (widget.controller.text.isEmpty && widget.radioOptions.isNotEmpty) { - widget.controller.text = widget.radioOptions[0]; - } - // else{ - // int index = widget.radioOptions - // .indexWhere((element) => element == option); - // _currentSelection = widget.radioOptions[index]; - // widget.controller.text = option; - - // } - // _currentSelection = widget.radioOptions[0]; - } - -// The method to handle a change in selection. - void _onChanged(String? value) { - if (value != null) { - widget.controller.text = value; - } - } - - Widget displayRadioOptions(String selection) { - return Material( - elevation: 4.0, - borderRadius: BorderRadius.circular(8.0), - child: Container( - decoration: BoxDecoration( - color: widget.fillColor, - borderRadius: BorderRadius.circular(8.0), - ), - child: Column( - children: widget.radioOptions.map((option) { - return GestureDetector( - onTap: () { - _onChanged(option); - }, - child: Row( - children: [ - const SizedBox(width: 10), - Expanded( - child: Text( - option, - style: TextStyle( - color: widget.secondaryFillColor, - fontWeight: FontWeight.w500, - fontSize: 15, - ), - ), - ), - Radio( - value: option, - groupValue: selection, - onChanged: _onChanged, - activeColor: widget.secondaryFillColor, - fillColor: WidgetStateProperty.resolveWith( - (Set states) { - if (states.contains(WidgetState.selected)) { - return widget.secondaryFillColor; // Color when selected - } - return widget.secondaryFillColor; - }), - ), - ], - ), - ); - }).toList(), - ), - ), - ); - } - - @override - Widget build(BuildContext context) { - return AnimatedBuilder( - animation: widget.controller, - builder: (context, child) { - final currentSelection = widget.controller.text; - return Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - widget.hintText, - textAlign: TextAlign.left, - style: TextStyle( - color: widget.fillColor, - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - Visibility( - visible: !widget.requiredText, - child: Text( - "(Optional)", - textAlign: TextAlign.right, - style: TextStyle( - color: widget.fillColor, - fontSize: 15, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - const SizedBox(height: 4), - displayRadioOptions(currentSelection), - ], - ); - }); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_scack_bar.dart b/mih_ui/lib/mih_package_components/mih_scack_bar.dart deleted file mode 100644 index 4a38e860..00000000 --- a/mih_ui/lib/mih_package_components/mih_scack_bar.dart +++ /dev/null @@ -1,18 +0,0 @@ -import 'package:flutter/material.dart'; - -SnackBar MihSnackBar({ - required Widget child, -}) { - return SnackBar( - content: child, - shape: StadiumBorder(), - behavior: SnackBarBehavior.floating, - duration: Duration(seconds: 2), - width: null, - action: SnackBarAction( - label: "Dismiss", - onPressed: () {}, - ), - // elevation: 30, - ); -} diff --git a/mih_ui/lib/mih_package_components/mih_search_bar.dart b/mih_ui/lib/mih_package_components/mih_search_bar.dart deleted file mode 100644 index 8bcf839e..00000000 --- a/mih_ui/lib/mih_package_components/mih_search_bar.dart +++ /dev/null @@ -1,190 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; - -class MihSearchBar extends StatefulWidget { - final TextEditingController controller; - final String hintText; - final IconData prefixIcon; - final IconData? prefixAltIcon; - final List? suffixTools; - final double? width; - final double? height; - final Color fillColor; - final Color hintColor; - final void Function()? onPrefixIconTap; - final void Function()? onClearIconTap; - final double? elevation; - final FocusNode searchFocusNode; - - const MihSearchBar({ - Key? key, - required this.controller, - required this.hintText, - required this.prefixIcon, - this.prefixAltIcon, - this.suffixTools, - this.width, - this.height, - required this.fillColor, - required this.hintColor, - required this.onPrefixIconTap, - this.onClearIconTap, - this.elevation, - required this.searchFocusNode, - }) : super(key: key); - - @override - State createState() => _MihSearchBarState(); -} - -class _MihSearchBarState extends State { - bool _showClearIcon = false; - - Widget getPrefixIcon() { - if (_showClearIcon) { - // If the clear icon is shown and an alternative prefix icon is provided, use it - return widget.prefixAltIcon != null - ? Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Icon( - widget.prefixAltIcon, - color: widget.hintColor, - size: 35, - ), - ) - : Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Icon( - Icons.search, - color: widget.hintColor, - size: 35, - ), - ); // Default to search icon if no alt icon - } else { - // Return the primary prefix icon or the alternative if provided - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Icon( - Icons.search, - color: widget.hintColor, - size: 35, - ), - ); - } - } - - @override - void initState() { - super.initState(); - // 1. Add the listener to the controller - widget.controller.addListener(_updateClearIconVisibility); - // 2. Initialize the clear icon visibility based on the current text - _updateClearIconVisibility(); - } - - @override - void dispose() { - widget.controller.removeListener(_updateClearIconVisibility); - super.dispose(); - } - - void _updateClearIconVisibility() { - if (!mounted) { - return; - } - final bool shouldShow = widget.controller.text.isNotEmpty; - // Only call setState if the visibility state actually changes - if (_showClearIcon != shouldShow) { - setState(() { - _showClearIcon = shouldShow; - }); - } - } - - @override - Widget build(BuildContext context) { - return Material( - elevation: widget.elevation ?? 4.0, // Use provided elevation or default - borderRadius: BorderRadius.circular(30.0), - color: widget.fillColor, - child: AnimatedContainer( - // Keep AnimatedContainer for width/height transitions - alignment: Alignment.centerLeft, - width: widget.width, - height: widget.height ?? 50, - duration: const Duration(milliseconds: 300), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(30.0), - ), - child: Theme( - data: Theme.of(context).copyWith( - textSelectionTheme: TextSelectionThemeData( - selectionColor: widget.hintColor.withValues(alpha: 0.3), - selectionHandleColor: widget.hintColor, - ), - ), - child: TextField( - textAlignVertical: TextAlignVertical.center, - controller: widget.controller, // Assign the controller - focusNode: widget.searchFocusNode, - autocorrect: true, - spellCheckConfiguration: - !kIsWeb && (Platform.isAndroid || Platform.isIOS) - ? SpellCheckConfiguration() - : null, - onSubmitted: (value) { - widget.onPrefixIconTap - ?.call(); // Call the prefix icon tap handler - }, - style: TextStyle( - color: widget.hintColor, - fontWeight: FontWeight.w600, - fontSize: 16, - ), - cursorColor: widget.hintColor, - decoration: InputDecoration( - isDense: true, - hintText: widget.hintText, - hintStyle: TextStyle( - color: widget.hintColor, - fontWeight: FontWeight.w600, - fontSize: 16, - ), - border: InputBorder.none, - contentPadding: - const EdgeInsets.symmetric(horizontal: 10.0, vertical: 15.0), - prefixIcon: GestureDetector( - onTap: widget.onPrefixIconTap, - child: getPrefixIcon(), - ), - suffixIcon: Row( - // Use a Row for multiple suffix icons - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - // Optional suffix tools - if (widget.suffixTools != null) ...widget.suffixTools!, - // Clear Icon (conditionally visible) - if (_showClearIcon) // Only show if input is not empty - IconButton( - iconSize: 35, - icon: Icon(Icons.clear, - color: widget.hintColor), // Clear icon - onPressed: widget.onClearIconTap ?? - () { - widget.controller.clear(); - // No need for setState here, _updateClearIconVisibility will handle it - }, - ), - ], - ), - ), - ), - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_single_child_scroll.dart b/mih_ui/lib/mih_package_components/mih_single_child_scroll.dart deleted file mode 100644 index 74c846b1..00000000 --- a/mih_ui/lib/mih_package_components/mih_single_child_scroll.dart +++ /dev/null @@ -1,31 +0,0 @@ -import 'package:flutter/material.dart'; - -class MihSingleChildScroll extends StatefulWidget { - final Widget child; - final bool? scrollbarOn; - const MihSingleChildScroll({ - super.key, - required this.child, - this.scrollbarOn, - }); - - @override - State createState() => _MihSingleChildScrollState(); -} - -class _MihSingleChildScrollState extends State { - @override - Widget build(BuildContext context) { - return SafeArea( - bottom: false, - minimum: EdgeInsets.only(bottom: 5), - child: ScrollConfiguration( - behavior: ScrollConfiguration.of(context) - .copyWith(scrollbars: widget.scrollbarOn ?? false), - child: SingleChildScrollView( - child: widget.child, - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_text_form_field.dart b/mih_ui/lib/mih_package_components/mih_text_form_field.dart deleted file mode 100644 index a2cac03e..00000000 --- a/mih_ui/lib/mih_package_components/mih_text_form_field.dart +++ /dev/null @@ -1,318 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihTextFormField extends StatefulWidget { - final double? width; - final double? height; - final Color fillColor; - final Color inputColor; - final TextEditingController controller; - final bool? hasError; - final String? hintText; - final double? borderRadius; - final bool? multiLineInput; - final bool? readOnly; - final bool? passwordMode; - final bool? numberMode; - final bool requiredText; - final FormFieldValidator? validator; - final List? autofillHints; - final double? elevation; - final TextAlign? textIputAlignment; - - const MihTextFormField({ - Key? key, - this.width, - this.height, - required this.fillColor, - required this.inputColor, - required this.controller, - this.hasError, - required this.hintText, - required this.requiredText, - this.borderRadius, - this.multiLineInput, - this.readOnly, - this.passwordMode, - this.numberMode, - this.validator, - this.autofillHints, - this.elevation, - this.textIputAlignment, - }) : super(key: key); - - @override - State createState() => _MihTextFormFieldState(); -} - -class _MihTextFormFieldState extends State { - late bool _obscureText; - FormFieldState? _formFieldState; - - @override - void initState() { - super.initState(); - _obscureText = widget.passwordMode ?? false; - widget.controller.addListener(_onControllerTextChanged); - } - - @override - void didUpdateWidget(covariant MihTextFormField oldWidget) { - super.didUpdateWidget(oldWidget); - // If the controller itself changes, remove listener from old and add to new - if (widget.controller != oldWidget.controller) { - oldWidget.controller.removeListener(_onControllerTextChanged); - widget.controller.addListener(_onControllerTextChanged); - // Immediately update form field state if controller changed and has value - _formFieldState?.didChange(widget.controller.text); - } - } - - void _onControllerTextChanged() { - // Only update the FormField's value if it's not already the same - // and if the formFieldState is available. - if (_formFieldState != null && - _formFieldState!.value != widget.controller.text) { - _formFieldState!.didChange(widget.controller.text); - } - } - - @override - void dispose() { - widget.controller.removeListener(_onControllerTextChanged); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - final isMultiline = widget.multiLineInput == true; - return Center( - child: SizedBox( - width: widget.width, - // height: widget.height, - height: isMultiline ? null : widget.height, - child: Theme( - data: Theme.of(context).copyWith( - textSelectionTheme: TextSelectionThemeData( - selectionColor: widget.inputColor.withValues(alpha: 0.3), - selectionHandleColor: widget.inputColor, - ), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Visibility( - visible: widget.hintText != null, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - widget.hintText ?? "", - textAlign: TextAlign.left, - style: TextStyle( - color: widget.fillColor, - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - Visibility( - visible: !widget.requiredText, - child: Text( - "(Optional)", - textAlign: TextAlign.right, - style: TextStyle( - color: widget.fillColor, - fontSize: 15, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - const SizedBox(height: 4), - FormField( - initialValue: widget.controller.text, - validator: widget.validator, - autovalidateMode: AutovalidateMode.onUserInteraction, - builder: (field) { - _formFieldState = field; - return Column( - crossAxisAlignment: - CrossAxisAlignment.start, // <-- Add this line - children: [ - Material( - elevation: widget.elevation ?? 4.0, - borderRadius: - BorderRadius.circular(widget.borderRadius ?? 8.0), - child: SizedBox( - height: widget.height != null - ? widget.height! - 30 - : null, - child: TextFormField( - controller: widget.controller, - cursorColor: widget.inputColor, - autofillHints: widget.autofillHints, - autocorrect: true, - // spellCheckConfiguration: (kIsWeb || - // widget.passwordMode == true || - // widget.numberMode == true) - // ? null - // : SpellCheckConfiguration(), - spellCheckConfiguration: !kIsWeb && - (Platform.isAndroid || Platform.isIOS) - ? SpellCheckConfiguration() - : null, - textAlign: - widget.textIputAlignment ?? TextAlign.start, - textAlignVertical: widget.multiLineInput == true - ? TextAlignVertical.top - : TextAlignVertical.center, - obscureText: widget.passwordMode == true - ? _obscureText - : false, - expands: widget.passwordMode == true - ? false - : (widget.multiLineInput ?? false), - maxLines: widget.passwordMode == true ? 1 : null, - readOnly: widget.readOnly ?? false, - keyboardType: widget.numberMode == true - ? const TextInputType.numberWithOptions( - decimal: true) - : null, - inputFormatters: widget.numberMode == true - ? [ - FilteringTextInputFormatter.allow( - RegExp(r'^\d*\.?\d*')) - ] - : null, - style: TextStyle( - color: widget.inputColor, - fontWeight: FontWeight.w500, - ), - decoration: InputDecoration( - suffixIcon: widget.passwordMode == true - ? FocusScope( - canRequestFocus: false, - child: IconButton( - icon: Icon( - _obscureText - ? Icons.visibility_off - : Icons.visibility, - color: widget.inputColor, - ), - onPressed: () { - setState(() { - _obscureText = !_obscureText; - }); - }, - ), - ) - : null, - errorStyle: const TextStyle( - height: 0, fontSize: 0), // <-- Add this line - contentPadding: const EdgeInsets.symmetric( - horizontal: 10.0, vertical: 8.0), - filled: true, - fillColor: widget.fillColor, - border: OutlineInputBorder( - borderRadius: BorderRadius.circular( - widget.borderRadius ?? 8.0), - borderSide: field.hasError - ? BorderSide( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - width: 2.0, - ) - : BorderSide.none, - ), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular( - widget.borderRadius ?? 8.0), - borderSide: BorderSide.none, - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular( - widget.borderRadius ?? 8.0), - borderSide: BorderSide( - color: field.hasError - ? MihColors.getRedColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark") - : widget.inputColor, - width: 3.0, - ), - ), - errorBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular( - widget.borderRadius ?? 8.0), - borderSide: BorderSide( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - width: 3.0, - ), - ), - focusedErrorBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular( - widget.borderRadius ?? 8.0), - borderSide: BorderSide( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - width: 3.0, - ), - ), - ), - onChanged: (value) { - field.didChange(value); - }, - ), - ), - ), - if (field.hasError) - Row( - children: [ - Padding( - padding: - const EdgeInsets.only(left: 8.0, top: 4.0), - child: Text( - field.errorText ?? '', - style: TextStyle( - fontSize: 12, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ], - ); - }, - ), - ], - ), - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_time_field.dart b/mih_ui/lib/mih_package_components/mih_time_field.dart deleted file mode 100644 index cd6fd5ad..00000000 --- a/mih_ui/lib/mih_package_components/mih_time_field.dart +++ /dev/null @@ -1,217 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihTimeField extends StatefulWidget { - final TextEditingController controller; - final String labelText; - final bool required; - final double? width; - final double? height; - final double? borderRadius; - final double? elevation; - final FormFieldValidator? validator; - - const MihTimeField({ - super.key, - required this.controller, - required this.labelText, - required this.required, - this.width, - this.height, - this.borderRadius, - this.elevation, - this.validator, - }); - - @override - State createState() => _MihTimeFieldState(); -} - -class _MihTimeFieldState extends State { - FormFieldState? _formFieldState; - - Future _selectTime(BuildContext context) async { - TimeOfDay? picked = await showTimePicker( - context: context, - initialTime: widget.controller.text.isNotEmpty - ? TimeOfDay( - hour: int.tryParse(widget.controller.text.split(":")[0]) ?? 0, - minute: int.tryParse(widget.controller.text.split(":")[1]) ?? 0, - ) - : TimeOfDay.now(), - builder: (context, child) { - return MediaQuery( - data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: true), - child: child as Widget, - ); - }, - ); - if (picked != null) { - final hours = picked.hour.toString().padLeft(2, '0'); - final minutes = picked.minute.toString().padLeft(2, '0'); - widget.controller.text = "$hours:$minutes"; - _formFieldState?.didChange(widget.controller.text); - setState(() {}); - } - } - - @override - Widget build(BuildContext context) { - return Center( - child: SizedBox( - width: widget.width, - height: widget.height, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - widget.labelText, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - if (!widget.required) - Text( - "(Optional)", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 15, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const SizedBox(height: 4), - FormField( - initialValue: widget.controller.text, - validator: widget.validator, - autovalidateMode: AutovalidateMode.onUserInteraction, - builder: (field) { - _formFieldState = field; - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Material( - elevation: widget.elevation ?? 4.0, - borderRadius: - BorderRadius.circular(widget.borderRadius ?? 8.0), - child: TextFormField( - controller: widget.controller, - readOnly: true, - onTap: () => _selectTime(context), - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.w500, - ), - decoration: InputDecoration( - suffixIcon: Icon( - Icons.access_time, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - errorStyle: const TextStyle(height: 0, fontSize: 0), - contentPadding: const EdgeInsets.symmetric( - horizontal: 10.0, vertical: 8.0), - filled: true, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular( - widget.borderRadius ?? 8.0), - borderSide: field.hasError - ? BorderSide( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - width: 2.0, - ) - : BorderSide.none, - ), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular( - widget.borderRadius ?? 8.0), - borderSide: BorderSide.none, - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular( - widget.borderRadius ?? 8.0), - borderSide: BorderSide( - color: field.hasError - ? MihColors.getRedColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark") - : MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - width: 3.0, - ), - ), - errorBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular( - widget.borderRadius ?? 8.0), - borderSide: BorderSide( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 3.0, - ), - ), - focusedErrorBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular( - widget.borderRadius ?? 8.0), - borderSide: BorderSide( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 3.0, - ), - ), - ), - onChanged: (value) { - field.didChange(value); - }, - ), - ), - if (field.hasError) - Padding( - padding: const EdgeInsets.only(left: 8.0, top: 4.0), - child: Text( - field.errorText ?? '', - style: TextStyle( - fontSize: 12, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ); - }, - ), - ], - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_toggle.dart b/mih_ui/lib/mih_package_components/mih_toggle.dart deleted file mode 100644 index 2ddc7c8b..00000000 --- a/mih_ui/lib/mih_package_components/mih_toggle.dart +++ /dev/null @@ -1,134 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihToggle extends StatefulWidget { - final String hintText; - final bool initialPostion; - final Color fillColor; - final Color secondaryFillColor; - final bool? readOnly; - final double? elevation; - final void Function(bool) onChange; - const MihToggle({ - super.key, - required this.hintText, - required this.initialPostion, - required this.fillColor, - required this.secondaryFillColor, - this.readOnly, - this.elevation, - required this.onChange, - }); - - @override - State createState() => _MihToggleState(); -} - -class _MihToggleState extends State { - late bool togglePosition; - - @override - void didUpdateWidget(covariant MihToggle oldWidget) { - super.didUpdateWidget(oldWidget); - if (widget.initialPostion != oldWidget.initialPostion) { - setState(() { - togglePosition = widget.initialPostion; - }); - } - } - - @override - void initState() { - super.initState(); - togglePosition = widget.initialPostion; - } - - @override - Widget build(BuildContext context) { - return Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: Text( - widget.hintText, - style: TextStyle( - fontWeight: FontWeight.bold, - color: widget.fillColor, - fontSize: 18, - ), - ), - ), - const SizedBox(width: 10), - // Material( - // elevation: widget.elevation ?? 0.01, - // shadowColor: widget.secondaryFillColor.withOpacity(0.5), - // color: Colors.transparent, - // shape: StadiumBorder(), - Container( - decoration: BoxDecoration( - color: Colors.transparent, - borderRadius: BorderRadius.circular( - 30), // Adjust the border radius to match the toggle - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.15), - offset: Offset( - 0, widget.elevation ?? 10), // Adjust the vertical offset - blurRadius: widget.elevation ?? 10, - spreadRadius: 0, - ), - ], - ), - child: Switch( - value: togglePosition, - trackOutlineColor: WidgetStateProperty.resolveWith( - (states) { - if (widget.readOnly == true) { - return Colors.grey; - } - if (states.contains(WidgetState.selected)) { - return MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"); // Outline color when active - } - return MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"); // Outline color when active - }, - ), - activeColor: widget.readOnly == true - ? Colors.grey - : widget.secondaryFillColor, - activeTrackColor: widget.readOnly == true - ? Colors.grey.shade400 - : MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inactiveThumbColor: widget.readOnly == true - ? Colors.grey - : widget.secondaryFillColor, - inactiveTrackColor: widget.readOnly == true - ? Colors.grey.shade400 - : MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // activeColor: widget.secondaryFillColor, - // activeTrackColor: widget.fillColor, - // inactiveThumbColor: widget.fillColor, - // inactiveTrackColor: widget.secondaryFillColor, - // onChanged: widget.readOnly != true ? widget.onChange : null, - onChanged: widget.readOnly != true - ? (newValue) { - setState(() { - togglePosition = newValue; // Update internal state - }); - widget.onChange(newValue); // Call the parent's onChange - } - : null, - ), - ), - const SizedBox(width: 10), - ], - ); - } -} diff --git a/mih_ui/lib/mih_package_components/mih_yt_video_player.dart b/mih_ui/lib/mih_package_components/mih_yt_video_player.dart deleted file mode 100644 index a9d3d381..00000000 --- a/mih_ui/lib/mih_package_components/mih_yt_video_player.dart +++ /dev/null @@ -1,46 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:youtube_player_iframe/youtube_player_iframe.dart'; - -class MIHYTVideoPlayer extends StatefulWidget { - final String videoYTLink; - const MIHYTVideoPlayer({ - super.key, - required this.videoYTLink, - }); - - @override - State createState() => _MIHYTVideoPlayerState(); -} - -class _MIHYTVideoPlayerState extends State { - late YoutubePlayerController _controller; - - @override - void dispose() { - _controller.close(); - super.dispose(); - } - - @override - void initState() { - _controller = YoutubePlayerController( - params: const YoutubePlayerParams( - enableCaption: false, - showControls: true, - mute: false, - showFullscreenButton: false, - loop: false, - ), - ); - _controller.loadVideoById(videoId: widget.videoYTLink); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return YoutubePlayer( - controller: _controller, - aspectRatio: 16 / 9, - ); - } -} diff --git a/mih_ui/lib/mih_packages/about_mih/about_mih.dart b/mih_ui/lib/mih_packages/about_mih/about_mih.dart deleted file mode 100644 index 5553462b..00000000 --- a/mih_ui/lib/mih_packages/about_mih/about_mih.dart +++ /dev/null @@ -1,102 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_providers/about_mih_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/about_mih/package_tools/mih_%20attributes.dart'; -import 'package:mzansi_innovation_hub/mih_packages/about_mih/package_tools/mih_info.dart'; -import 'package:mzansi_innovation_hub/mih_packages/about_mih/package_tools/mih_privacy_policy.dart'; -import 'package:mzansi_innovation_hub/mih_packages/about_mih/package_tools/mih_terms_of_service.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class AboutMih extends StatefulWidget { - const AboutMih({ - super.key, - }); - - @override - State createState() => _AboutMihState(); -} - -class _AboutMihState extends State { - late final MihInfo _info; - late final MihPrivacyPolicy _privacyPolicy; - late final MIHTermsOfService _termsOfService; - late final MihAttributes _attributes; - - @override - void initState() { - _info = MihInfo(); - _privacyPolicy = MihPrivacyPolicy(); - _termsOfService = MIHTermsOfService(); - _attributes = MihAttributes(); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: getToolTitle(), - selectedbodyIndex: context.watch().toolIndex, - onIndexChange: (newIndex) { - context.read().setToolIndex(newIndex); - }, - ); - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - context.goNamed( - 'mihHome', - ); - FocusScope.of(context).unfocus(); - }, - ); - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.info)] = () { - context.read().setToolIndex(0); - }; - temp[const Icon(Icons.policy)] = () { - context.read().setToolIndex(1); - }; - temp[const Icon(Icons.design_services)] = () { - context.read().setToolIndex(2); - }; - temp[const Icon(Icons.star_rounded)] = () { - context.read().setToolIndex(3); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: context.watch().toolIndex, - ); - } - - List getToolBody() { - return [ - _info, - _privacyPolicy, - _termsOfService, - _attributes, - ]; - } - - List getToolTitle() { - List toolTitles = [ - "About", - "Privacy Policy", - "Terms of Service", - "Attributions", - ]; - return toolTitles; - } -} diff --git a/mih_ui/lib/mih_packages/about_mih/mih_policy_tos_ext/policy_and_terms_text.dart b/mih_ui/lib/mih_packages/about_mih/mih_policy_tos_ext/policy_and_terms_text.dart deleted file mode 100644 index 90570143..00000000 --- a/mih_ui/lib/mih_packages/about_mih/mih_policy_tos_ext/policy_and_terms_text.dart +++ /dev/null @@ -1,1007 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class PolicyAndTermsText { - List getPrivacyPolicyText(BuildContext context, bool english) { - String effectDate = english ? "6 December 2024" : "2024年12月6日"; - String intro = english - ? "Mzansi Innovation Hub - MIH (\"we,\" \"our,\" \"us\") values your privacy and is committed to protecting your personal data. This Privacy Policy explains how we collect, use, disclose, and safeguard your information when you use our app, Mzansi Innovation Hub - MIH, available globally." - : "Mzansi Innovation Hub - MIH(“我们”)重视您的隐私,并致力于保护您的个人数据。本隐私政策解释了当您使用我们面向全球推出的应用程序 Mzansi Innovation Hub - MIH 时,我们如何收集、使用、披露和保护您的信息。"; - String infoCollect = english - ? "We collect the following personal information to provide and improve our services:\n• Personal Details: Name, ID, address, phone number etc.\n• Medical Information: Medical aid details (if applicable).\n• Loyalty Card Information: Loyalty card numbers for the Mzansi Wallet feature." - : "我们收集以下个人信息以提供和改进我们的服务:\n• 个人详细信息:姓名、身份证、地址、电话号码等。\n• 医疗信息:医疗援助详情(如适用)。\n• 忠诚卡信息:Mzansi Wallet 功能的忠诚卡号码。"; - String useInfo = english - ? "Your personal information is used for the following purposes:\n• To create and manage your account.\n• To facilitate interactions between clients and businesses.\n• To enable the storage of loyalty card information within the Mzansi Wallet.\n• To provide technical support and improve our app's functionality." - : "您的个人信息用于以下目的:\n• 创建和管理您的账户。\n• 促进客户与企业之间的互动。\n• 使忠诚卡信息能够存储在 Mzansi Wallet 中。\n• 提供技术支持并改进我们应用程序的功能。"; - String dataShare = english - ? "We only share your data under the following conditions:\n• With Your Consent: Businesses can access your information only with your explicit permission.\n• Legal Obligations: We may disclose information to comply with applicable laws or regulations." - : "我们仅在以下情况下共享您的数据:\n• 经您同意:企业只能在您明确许可的情况下访问您的信息。\n• 法律义务:我们可能会披露信息以遵守适用的法律或法规。"; - String dataSec = english - ? "We implement advanced security measures to protect your personal data:\n• Data encryption during transmission.\n• Secure authentication protocols to prevent unauthorized access.\n• Regular audits to identify and address vulnerabilities." - : "我们实施先进的安全措施来保护您的个人数据:\n• 传输过程中对数据进行加密。\n• 安全的身份验证协议以防止未经授权的访问。\n• 定期审计以识别和解决漏洞。"; - - String yourRights = english - ? "You have the following rights regarding your personal data:\n• Access and Correction: View and update your information via your account settings.\n• Data Deletion: Request the deletion of your account and associated data.\n• Withdrawal of Consent: Revoke permissions for businesses to access your data is restricted once granted.\n• To exercise these rights, contact us at mzansi.innovation.hub@gmail.com." - : "您对您的个人数据享有以下权利:\n• 访问和更正:通过您的账户设置查看和更新您的信息。\n• 数据删除:请求删除您的账户及相关数据。\n• 撤回同意:一旦授予权限,撤销企业访问您数据的权限将受到限制。\n• 要行使这些权利,请通过 mzansi.innovation.hub@gmail.com 与我们联系。"; - String dataRet = english - ? "We retain your personal data for as long as necessary to provide our services. Upon account deletion, your data will be permanently removed unless required by law to retain certain records." - : "我们会在提供服务所需的时间内保留您的个人数据。账户删除后,您的数据将被永久删除,除非法律要求保留某些记录。"; - String policyChanges = english - ? "We may update this Privacy Policy to reflect changes in our practices or legal requirements. We will notify you of significant updates via in app notifications and/ or email." - : "我们可能会更新本隐私政策以反映我们的做法或法律要求的变化。我们将通过应用内通知和/或电子邮件通知您重大更新。"; - String contactUs = english - ? "If you have questions or concerns about this Privacy Policy, please contact us:\n• Email: mzansi.innovation.hub@gmail.com\n• Phone: +27 655 530 195\n" - : "如果您对本隐私政策有任何疑问或担忧,请通过以下方式与我们联系:\n• 电子邮件: mzansi.innovation.hub@gmail.com.\n• 电话: +27 655 530 195"; - return [ - SizedBox( - width: 165, - child: FittedBox( - child: Icon( - MihIcons.mihLogo, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ), - const SizedBox(height: 10), - //=============== Effective Date =============== - SizedBox( - width: 1250, - child: Row( - children: [ - Text( - english ? "Effective Date: " : "生效日期: ", - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 15, - ), - ), - Text( - effectDate, - textAlign: TextAlign.center, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== Introduction =============== - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - intro, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 1. Information We Collect =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "1. Information We Collect" : "1. 我们收集的信息", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - infoCollect, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 2. How We Use Your Information =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "2. How We Use Your Information" : "2. 我们如何使用您的信息", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - useInfo, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 3. Data Sharing =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "3. Data Sharing" : "3. 数据共享", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - dataShare, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 4. Data Security =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "4. Data Security" : "4. 数据安全", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - dataSec, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 5. Your Rights =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "5. Your Rights" : "5. 您的权利", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - yourRights, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 6. Data Retention =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "6. Data Retention" : "6. 数据保留", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - dataRet, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 7. Changes to This Privacy Policy =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "7. Changes to This Privacy Policy" : "7. 本隐私政策的变更", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - policyChanges, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 8. Contact Us =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "8. Contact Us" : "8. 联系我们", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - contactUs, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - ]; - } - - List getTermsOfServiceText(BuildContext context, bool english) { - String effectDate = english ? "6 December 2024" : "2024年12月6日"; - String intro = english - ? "Welcome to Mzansi Innovation Hub (MIH)! These Terms of Service (\"Terms\") govern your access to and use of our application and services (\"Services\"). By accessing or using Mzansi Innovation Hub (MIH), you agree to these Terms." - : "欢迎使用 Mzansi Innovation Hub (MIH)!本服务条款(“条款”)管理您对我们应用程序和服务(“服务”)的访问和使用。通过访问或使用 Mzansi Innovation Hub (MIH),您同意这些条款。"; - String acceptTerms = english - ? "By creating an account or using the app, you agree to be bound by these Terms. If you do not agree, please do not use the Services." - : "通过创建账户或使用该应用程序,您同意受这些条款的约束。如果您不同意,请不要使用该服务。"; - String eligib = english - ? "You must be at least 18 years old or the age of majority in your jurisdiction to use this app. By using the app, you represent and warrant that you meet these eligibility requirements." - : "您必须年满18岁或达到您所在司法管辖区的法定年龄才能使用此应用程序。通过使用该应用程序,您声明并保证您符合这些资格要求。"; - String yourResponse = english - ? "• Account Security: You are responsible for maintaining the confidentiality of your login credentials.\n• Accurate Information: Ensure that all data you provide is accurate and up to date.\n• Prohibited Uses:\n\t\t• Do not use the app for unlawful purposes.\n\t\t• Do not engage in activities that could harm the app or its users, such as hacking, data scraping, or introducing malware." - : "• 账户安全:您有责任维护您的登录凭据的机密性。\n• 准确信息:确保您提供的所有数据都是准确和最新的。\n• 禁止使用:\n\t\t• 不得将该应用程序用于非法目的。\n\t\t• 不得从事可能损害该应用程序或其用户的活动,例如黑客攻击、数据抓取或引入恶意软件。"; - String ourServ = english - ? "• We provide tools to help businesses and clients interact, including a patient manager and the Mzansi Wallet etc.\n• We do not guarantee uninterrupted or error-free services, though we strive to maintain high reliability." - : "• 我们提供工具来帮助企业和客户互动,包括患者管理器和 Mzansi Wallet 等。\n• 我们不保证服务不中断或无错误,但我们努力保持高可靠性。"; - - String dataCol = english - ? "Your use of the app is subject to our Privacy Policy, which explains how we collect, use, and protect your data. By using the app, you consent to these practices." - : "您对该应用程序的使用受我们的隐私政策约束,该政策解释了我们如何收集、使用和保护您的数据。通过使用该应用程序,您同意这些做法。"; - String userContent = english - ? "• Ownership: Any content you submit to the app (e.g., loyalty card data, client profiles) remains your property.\n• License: By using the app, you grant us a non-exclusive license to use your content solely to operate the app and provide services." - : "• 所有权:您提交到该应用程序的任何内容(例如,忠诚卡数据、客户档案)仍然是您的财产。\n• 许可:通过使用该应用程序,您授予我们非独占许可,仅用于运营该应用程序和提供服务。"; - String intelProp = english - ? "• All rights to the app, including designs, code, and trademarks, belong to Mzansi Innovation Hub.\n• Users may not copy, distribute, or reverse-engineer any part of the app." - : "• 该应用程序的所有权利,包括设计、代码和商标,均属于 Mzansi Innovation Hub。\n• 用户不得复制、分发或反向工程该应用程序的任何部分。"; - String termUse = english - ? "We reserve the right to suspend or terminate your account for violations of these Terms or if required by law." - : "我们保留因违反这些条款或法律要求而暂停或终止您账户的权利。"; - String disclaimerWarens = english - ? "The app and services are provided \"as is\" without warranties of any kind, whether express or implied. We do not guarantee that the app will meet your expectations or requirements." - : "该应用程序和服务按“原样”提供,不附带任何形式的明示或暗示保证。我们不保证该应用程序将满足您的期望或要求。"; - String limitLiability = english - ? "To the maximum extent permitted by law, we are not liable for:\n• Indirect, incidental, or consequential damages arising from the use or inability to use the app.\n• Loss of data, revenue, or profits." - : "在法律允许的最大范围内,我们不对以下事项承担责任:\n• 因使用或无法使用该应用程序而产生的间接、附带或后果性损害。\n• 数据、收入或利润的损失。"; - String modifyTerms = english - ? "We may update these Terms periodically. Continued use of the app after changes are posted constitutes your acceptance of the new Terms." - : "我们可能会定期更新这些条款。在更改发布后继续使用该应用程序即表示您接受新的条款。"; - String governLaw = english - ? "These Terms are governed by the laws of South Africa. Any disputes will be resolved in courts located in South Africa." - : "这些条款受南非法律管辖。任何争议将由位于南非的法院解决。"; - String contactUs = english - ? "If you have questions about these Terms, please contact us:\n• Email: mzansi.innovation.hub@gmail.com\n• Phone: +27 655 530 195\n" - : "如果您对这些条款有任何疑问,请通过以下方式与我们联系:\n• 电子邮件: mzansi.innovation.hub@gmail.com.\n• 电话: +27 655 530 195"; - return [ - SizedBox( - width: 165, - child: FittedBox( - child: Icon( - MihIcons.mihLogo, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ), - const SizedBox( - height: 10, - ), - //=============== Effective Date =============== - SizedBox( - width: 1250, - child: Row( - children: [ - Text( - english ? "Effective Date: " : "生效日期: ", - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 15, - ), - ), - Text( - effectDate, - textAlign: TextAlign.center, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== Introduction =============== - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - intro, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 1. Acceptance of Terms =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "1. Acceptance of Terms" : "1. 接受条款", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - acceptTerms, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 2. Eligibility =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "2. Eligibility" : "2. 资格", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - eligib, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 3. Your Responsibilities =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "3. Your Responsibilities" : "3. 您的责任", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - yourResponse, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 4. Data Security =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "4. Our Services" : "4. 我们的服务", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - ourServ, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 5. Data Collection and Privacy =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "5. Data Collection and Privacy" : "5. 数据收集和隐私", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - dataCol, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 6. User-Generated Content =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "6. User-Generated Content" : "6. 用户生成的内容", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - userContent, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 7. Intellectual Property =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "7. Intellectual Property" : "7. 知识产权", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - intelProp, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 8. Termination of Use =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "8. Termination of Use" : "8. 使用终止", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - termUse, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 9. Disclaimer of Warranties =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "9. Disclaimer of Warranties" : "9. 免责声明", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - disclaimerWarens, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 10. Limitation of Liability =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "10. Limitation of Liability" : "10. 责任限制", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - limitLiability, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 11. Modifications to Terms =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "11. Modifications to Terms" : "11. 条款修改", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - modifyTerms, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 12. Governing Law =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "12. Governing Law" : "12. 适用法律", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - governLaw, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - //=============== 13. Contact Information =============== - SizedBox( - width: 1250, - child: Row( - // crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - english ? "13. Contact Information" : "13. 联系信息", - textAlign: TextAlign.start, - softWrap: true, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - width: 1250, - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.start, - children: [ - Text( - contactUs, - textAlign: TextAlign.start, - softWrap: true, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - ]; - } -} diff --git a/mih_ui/lib/mih_packages/about_mih/package_tile/about_mih_tile.dart b/mih_ui/lib/mih_packages/about_mih/package_tile/about_mih_tile.dart deleted file mode 100644 index c1e28031..00000000 --- a/mih_ui/lib/mih_packages/about_mih/package_tile/about_mih_tile.dart +++ /dev/null @@ -1,44 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class AboutMihTile extends StatefulWidget { - final double packageSize; - const AboutMihTile({ - super.key, - required this.packageSize, - }); - - @override - State createState() => _AboutMihTileState(); -} - -class _AboutMihTileState extends State { - @override - Widget build(BuildContext context) { - return MihPackageTile( - onTap: () { - context.goNamed( - "aboutMih", - ); - // Navigator.of(context).pushNamed( - // '/about', - // arguments: 0, - // ); - }, - appName: "About MIH", - appIcon: Icon( - MihIcons.aboutMih, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // size: widget.packageSize, - ), - iconSize: widget.packageSize, - textColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } -} diff --git a/mih_ui/lib/mih_packages/about_mih/package_tools/mih_ attributes.dart b/mih_ui/lib/mih_packages/about_mih/package_tools/mih_ attributes.dart deleted file mode 100644 index d1918fbb..00000000 --- a/mih_ui/lib/mih_packages/about_mih/package_tools/mih_ attributes.dart +++ /dev/null @@ -1,141 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class MihAttributes extends StatefulWidget { - const MihAttributes({super.key}); - - @override - State createState() => _MihAttributesState(); -} - -class _MihAttributesState extends State { - Future launchUrlLink(Uri linkUrl) async { - if (!await launchUrl(linkUrl)) { - throw Exception('Could not launch $linkUrl'); - } - } - - Widget displayAttribution(IconData resource, String creator, String link) { - return GestureDetector( - onTap: () { - launchUrlLink( - Uri.parse( - link, - ), - ); - }, - child: Column( - children: [ - Icon( - resource, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - size: 100, - ), - const SizedBox(height: 5), - Text( - creator, - style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold), - ), - ], - ), - ); - } - - @override - Widget build(BuildContext context) { - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(), - ); - } - - Widget getBody() { - String message = - "Some APIs, Icons and Assets used in MIH were sourced from third party providers.\n"; - message += - "We are grateful to the talented creators for providing these resources.\n"; - message += - "As per the terms for free use for these third party providers, the following assets require attribution"; - - return MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - children: [ - Icon( - MihIcons.mihLogo, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - size: 165, - ), - const SizedBox( - height: 10, - ), - SelectableText( - message, - style: const TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox( - height: 10, - ), - SizedBox( - width: 900, - child: Wrap( - alignment: WrapAlignment.center, - runSpacing: 10, - spacing: 10, - children: [ - displayAttribution(MihIcons.mihRing, "Tarah Meth", - "https://www.linkedin.com/in/tarah-meth-3b6309254/"), - displayAttribution(MihIcons.mihLogo, "Tarah Meth", - "https://www.linkedin.com/in/tarah-meth-3b6309254/"), - displayAttribution( - MihIcons.mzansiAi, "Ollama", "https://ollama.com/"), - displayAttribution(MihIcons.mzansiWallet, "Freepik", - "https://www.flaticon.com/free-icon/wallet-passes-app_3884407?term=wallet&page=1&position=21&origin=search&related_id=3884407"), - displayAttribution(MihIcons.patientProfile, "RaftelDesign", - "https://www.flaticon.com/free-icon/patient_2376100?term=medication&page=1&position=6&origin=search&related_id=2376100"), - displayAttribution(MihIcons.patientProfile, "Srip", - "https://www.flaticon.com/free-icon/hospital_1233930?term=medical+snake&page=1&position=7&origin=search&related_id=1233930"), - displayAttribution(MihIcons.calendar, "Freepik", - "https://www.flaticon.com/free-icon/calendar_2278049?term=calendar&page=1&position=5&origin=search&related_id=2278049"), - displayAttribution(MihIcons.calculator, "Freepik", - "https://www.flaticon.com/free-icon/calculator_2374409?term=calculator&page=1&position=20&origin=search&related_id=2374409"), - displayAttribution(MihIcons.aboutMih, "Chanut", - "https://www.flaticon.com/free-icon/info_151776?term=about&page=1&position=8&origin=search&related_id=151776"), - displayAttribution(MihIcons.personalProfile, "Freepik", - "https://www.flaticon.com/free-icon/user_1077063?term=profile&page=1&position=6&origin=search&related_id=1077063"), - displayAttribution(MihIcons.businessProfile, "Gravisio", - "https://www.flaticon.com/free-icon/contractor_11813336?term=company+profile&page=1&position=2&origin=search&related_id=11813336"), - displayAttribution(MihIcons.patientManager, "Vector Tank", - "https://www.flaticon.com/free-icon/doctor_10215061?term=doctor&page=1&position=73&origin=search&related_id=10215061"), - displayAttribution(MihIcons.profileSetup, "Freepik", - "https://www.flaticon.com/free-icon/add-user_748137?term=profile+add&page=1&position=1&origin=search&related_id=748137"), - displayAttribution(MihIcons.businessSetup, "kerismaker", - "https://www.flaticon.com/free-icon/business_13569850?term=company+add&page=1&position=25&origin=search&related_id=13569850"), - displayAttribution(MihIcons.calculator, "fawazahmed0", - "https://github.com/fawazahmed0/exchange-api"), - displayAttribution(MihIcons.iDontKnow, "Freepik", - "https://www.flaticon.com/free-icon/i-dont-know_5359909?term=i+dont+know&page=1&position=7&origin=search&related_id=5359909"), - ], - ), - ), - const SizedBox( - height: 30, - ), - ], - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/about_mih/package_tools/mih_info.dart b/mih_ui/lib/mih_packages/about_mih/package_tools/mih_info.dart deleted file mode 100644 index 125a3762..00000000 --- a/mih_ui/lib/mih_packages/about_mih/package_tools/mih_info.dart +++ /dev/null @@ -1,1027 +0,0 @@ -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/profile_link.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_profile_links.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_install_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart'; -import 'package:url_launcher/url_launcher.dart'; -import 'package:redacted/redacted.dart'; -import 'package:share_plus/share_plus.dart'; - -class MihInfo extends StatefulWidget { - const MihInfo({super.key}); - - @override - State createState() => _MihInfoState(); -} - -class _MihInfoState extends State { - late Future _futureUserCount; - late Future _futureBusinessCount; - - Widget founderBio() { - String bio = ""; - bio += "BSc Computer Science & Information Systems\n"; - bio += "(University of the Western Cape)\n"; - bio += - "6 Year of banking experience with one of the big 5 banks of South Africa."; - return Wrap( - alignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - spacing: 10, - runSpacing: 10, - children: [ - SizedBox( - width: 300, - child: Stack( - alignment: Alignment.center, - fit: StackFit.loose, - children: [ - Padding( - padding: const EdgeInsets.only(left: 4.0), - child: CircleAvatar( - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - backgroundImage: const AssetImage( - "lib/mih_package_components/assets/images/founder.jpg"), - //'https://media.licdn.com/dms/image/D4D03AQGd1-QhjtWWpA/profile-displayphoto-shrink_400_400/0/1671698053061?e=2147483647&v=beta&t=a3dJI5yxs5-KeXjj10LcNCFuC9IOfa8nNn3k_Qyr0CA'), - radius: 75, - ), - ), - Icon( - MihIcons.mihRing, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ], - ), - ), - SizedBox( - width: 400, - child: Text( - bio, - textAlign: TextAlign.center, - style: const TextStyle( - //fontWeight: FontWeight.bold, - fontSize: 17, - ), - ), - ), - const SizedBox( - height: 10, - ), - ], - ); - } - - Widget founderTitle() { - String heading = "Yasien Meth (Founder & CEO)"; - return Column( - children: [ - Text( - heading, - textAlign: TextAlign.center, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25, - ), - ), - const SizedBox( - height: 10, - ), - ], - ); - } - - Widget ourVision() { - String heading = "Our Vision"; - String vision = - "Digitizing Mzansi one process at a time. Discover essential Mzansi apps to streamline your personal and professional life. Simplify your daily tasks with our user-friendly solutions."; - - return SizedBox( - width: 500, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Text( - heading, - textAlign: TextAlign.center, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25, - ), - ), - const SizedBox( - height: 10, - ), - Text( - vision, - textAlign: TextAlign.center, - style: const TextStyle( - //fontWeight: FontWeight.bold, - fontSize: 17, - ), - ), - ], - ), - ); - } - - Widget ourMission() { - String heading = "Our Mission"; - String mission = - "Bridge the digital divide in Mzansi, ensuring that everyone can benefit from the power of technology. We empower lives by providing simple, elegant solutions that elevate daily experiences. With our user-friendly approach, we're making the digital world accessible to all, ensuring no one is left behind in the digital revolution."; - return SizedBox( - width: 500, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - heading, - textAlign: TextAlign.center, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25, - ), - ), - const SizedBox( - height: 10, - ), - Text( - mission, - textAlign: TextAlign.center, - style: const TextStyle( - //fontWeight: FontWeight.bold, - fontSize: 17, - ), - ), - ], - ), - ); - } - - Future launchSocialUrl(Uri linkUrl) async { - if (!await launchUrl(linkUrl)) { - throw Exception('Could not launch $linkUrl'); - } - } - - Widget getInstallButtonText() { - final isWebAndroid = - kIsWeb && (defaultTargetPlatform == TargetPlatform.android); - final isWebIos = kIsWeb && (defaultTargetPlatform == TargetPlatform.iOS); - String btnText = ""; - IconData platformIcon; - if (isWebAndroid) { - btnText = "Install MIH"; - platformIcon = FontAwesomeIcons.googlePlay; - } else if (isWebIos) { - btnText = "Install MIH"; - platformIcon = FontAwesomeIcons.appStoreIos; - } else if (MzansiInnovationHub.of(context)!.theme.getPlatform() == - "Android") { - btnText = "Update MIH"; - platformIcon = FontAwesomeIcons.googlePlay; - } else if (MzansiInnovationHub.of(context)!.theme.getPlatform() == "iOS") { - btnText = "Update MIH"; - platformIcon = FontAwesomeIcons.appStoreIos; - } else { - btnText = "Install MIH"; - platformIcon = FontAwesomeIcons.globe; - } - return Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FaIcon( - platformIcon, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(width: 10), - Text( - btnText, - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ], - ); - } - - void shareMIHLink(BuildContext context, String message, String link) { - String shareText = "$message: $link"; - SharePlus.instance.share( - ShareParams(text: shareText), - ); - } - - Widget displayBusinessCount() { - return Row( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - FutureBuilder( - future: _futureBusinessCount, - builder: (context, snapshot) { - bool isLoading = true; - String userCount = "⚠️"; - if (snapshot.connectionState == ConnectionState.waiting) { - isLoading = true; - } else if (snapshot.connectionState == ConnectionState.done && - snapshot.hasError) { - isLoading = false; - } else if (snapshot.connectionState == ConnectionState.done && - snapshot.hasData) { - isLoading = false; - userCount = snapshot.data.toString(); - } else { - isLoading = true; - } - return SizedBox( - child: Text( - userCount, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 23, - ), - ), - ).redacted( - context: context, - redact: isLoading, - configuration: RedactedConfiguration( - defaultBorderRadius: BorderRadius.circular(5), - redactedColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark", - ), - ), - ); - }, - ), - const SizedBox(width: 10), - Text( - "Businesses", - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.normal, - fontSize: 20, - ), - ), - ], - ); - } - - Widget displayUserCount() { - return Row( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - FutureBuilder( - future: _futureUserCount, - builder: (context, snapshot) { - bool isLoading = true; - String userCount = "⚠️"; - if (snapshot.connectionState == ConnectionState.waiting) { - isLoading = true; - } else if (snapshot.connectionState == ConnectionState.done && - snapshot.hasError) { - isLoading = false; - } else if (snapshot.connectionState == ConnectionState.done && - snapshot.hasData) { - isLoading = false; - userCount = snapshot.data.toString(); - } else { - isLoading = true; - } - return SizedBox( - child: Text( - userCount, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 23, - ), - ), - ).redacted( - context: context, - redact: isLoading, - configuration: RedactedConfiguration( - defaultBorderRadius: BorderRadius.circular(5), - redactedColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark", - ), - ), - ); - }, - ), - const SizedBox(width: 10), - Text( - "People", - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.normal, - fontSize: 20, - ), - ), - ], - ); - } - - Widget mihDivider() { - return Padding( - padding: EdgeInsets.symmetric( - vertical: 10.0, - horizontal: 25, - ), - child: Divider( - thickness: 1, - color: MihColors.getGreyColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ); - } - - Widget aboutHeadings() { - return Column( - children: [ - SizedBox( - width: 165, - child: FittedBox( - child: Icon( - MihIcons.mihLogo, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ), - const SizedBox( - height: 10, - ), - const Text( - "Mzansi Innovation Hub", - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 30, - ), - ), - Text( - "MIH App Version: ${MzansiInnovationHub.of(context)!.theme.getLatestVersion()}", - textAlign: TextAlign.center, - style: const TextStyle( - fontWeight: FontWeight.normal, - fontSize: 15, - ), - ), - const SizedBox( - height: 10, - ), - ], - ); - } - - Widget communityCounter() { - return Column( - children: [ - Wrap( - alignment: WrapAlignment.spaceAround, - crossAxisAlignment: WrapCrossAlignment.center, - spacing: 25, - runSpacing: 10, - children: [ - displayUserCount(), - displayBusinessCount(), - ], - ), - Text( - "The MIH Community", - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 22, - ), - ), - const SizedBox( - height: 10, - ), - ], - ); - } - - Widget callToActionsButtons() { - return Column( - children: [ - Wrap( - alignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - spacing: 10, - runSpacing: 10, - children: [ - MihButton( - onPressed: () { - if (MzansiInnovationHub.of(context)!.theme.getPlatform() == - "Android") { - showDialog( - context: context, - builder: (context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: "Select Option", - onWindowTapClose: () { - context.pop(); - }, - windowBody: Column( - children: [ - Text( - "Please select the platform you want to install/ Update MIH from", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 25), - MihButton( - onPressed: () { - launchSocialUrl( - Uri.parse( - "https://play.google.com/store/apps/details?id=za.co.mzansiinnovationhub.mih", - ), - ); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FaIcon( - FontAwesomeIcons.googlePlay, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - const SizedBox(width: 10), - Text( - "Play Store", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - MihButton( - onPressed: () { - launchSocialUrl( - Uri.parse( - "https://appgallery.huawei.com/app/C113315335?pkgName=za.co.mzansiinnovationhub.mih", - ), - ); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FaIcon( - Icons.store, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - const SizedBox(width: 10), - Text( - "App Gallery", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - ], - ), - ); - }, - ); - } else { - MihInstallServices().installMihTrigger(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: getInstallButtonText(), - ), - MihButton( - onPressed: () { - launchSocialUrl( - Uri.parse( - "https://www.youtube.com/playlist?list=PLuT35kJIui0H5kXjxNOZlHoOPZbQLr4qh", - ), - ); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FaIcon( - FontAwesomeIcons.youtube, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(width: 10), - Text( - "MIH Beginners Guide", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - MihButton( - onPressed: () { - launchSocialUrl( - Uri.parse( - "https://patreon.com/MzansiInnovationHub?utm_medium=unknown&utm_source=join_link&utm_campaign=creatorshare_creator&utm_content=copyLink", - ), - ); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FaIcon( - FontAwesomeIcons.patreon, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(width: 10), - Text( - "Support Our Journey", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - ], - ), - const SizedBox( - height: 10, - ), - ], - ); - } - - Widget womenForChange() { - String heading = "MIH Stands with Women For Change SA"; - String mission = - "South Africa is facing a devastating crisis of Gender-Based Violence and Femicide (GBVF), with at least 15 women murdered and 117 women reporting rape daily, often at the hands of known individuals, as highlighted by a shocking 33.8% rise in femicide in the last year, despite the existence of the National Strategic Plan on GBVF (NSP GBVF). Due to the government's lack of urgent action and funding for the NSP GBVF's implementation, organizations like Women For Change are urgently calling for the immediate declaration of GBVF as a National Disaster to mobilize resources and political will for decisive action, which must include judicial reforms (like opposing bail and implementing harsher sentences), immediate funding of the NSP GBVF and the new National Council, making the National Sex Offenders Register publicly accessible, and mandating comprehensive GBVF education and continuous public awareness campaigns."; - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 25.0), - child: SizedBox( - width: 500, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - heading, - textAlign: TextAlign.center, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25, - ), - ), - const SizedBox( - height: 10, - ), - Wrap( - alignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - spacing: 10, - runSpacing: 10, - children: [ - MihButton( - onPressed: () { - launchSocialUrl( - Uri.parse( - "https://www.tiktok.com/@womenforchange.sa", - ), - ); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FaIcon( - FontAwesomeIcons.tiktok, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - const SizedBox(width: 10), - Text( - "@womenforchange.sa", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - MihButton( - onPressed: () { - launchSocialUrl( - Uri.parse( - "https://www.change.org/p/declare-gbvf-a-national-disaster-in-south-africa", - ), - ); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FaIcon( - Icons.edit, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - const SizedBox(width: 10), - Text( - "Sign Petition", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - ], - ), - const SizedBox( - height: 10, - ), - Text( - mission, - textAlign: TextAlign.center, - style: const TextStyle( - //fontWeight: FontWeight.bold, - fontSize: 17, - ), - ), - ], - ), - ), - ); - } - - Widget missionAndVission() { - return Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 25.0), - child: Wrap( - alignment: WrapAlignment.start, - crossAxisAlignment: WrapCrossAlignment.start, - spacing: 10, - runSpacing: 10, - children: [ - ourVision(), - ourMission(), - ], - ), - ), - const SizedBox( - height: 10, - ), - ], - ); - } - - Widget founderDetails() { - return Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - founderTitle(), - founderBio(), - ], - ); - } - - Widget mihSocials() { - List links = [ - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Youtube", - web_link: "https://www.youtube.com/@MzansiInnovationHub", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "TikTok", - web_link: "https://www.tiktok.com/@mzansiinnovationhub", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Twitch", - web_link: "https://www.twitch.tv/mzansiinnovationhub", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Threads", - web_link: "https://www.threads.com/@mzansi.innovation.hub", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "WhatsApp", - web_link: "https://whatsapp.com/channel/0029Vax3INCIyPtMn8KgeM2F", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Instagram", - web_link: "https://www.instagram.com/mzansi.innovation.hub/", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "X", - web_link: "https://x.com/mzansi_inno_hub", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "LinkedIn", - web_link: "https://www.linkedin.com/company/mzansi-innovation-hub/", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Facebook", - web_link: "https://www.facebook.com/profile.php?id=61565345762136", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Reddit", - web_link: "https://www.reddit.com/r/Mzani_Innovation_Hub/", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Git", - web_link: - "https://git.mzansi-innovation-hub.co.za/yaso_meth/mih-project", - ), - ]; - return Column( - children: [ - Text( - "Follow Our Journey", - textAlign: TextAlign.center, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25, - ), - ), - const SizedBox( - height: 10, - ), - MihProfileLinks(links: links), - const SizedBox( - height: 75, - ), - ], - ); - } - - @override - void initState() { - super.initState(); - _futureUserCount = MihUserServices().fetchUserCount(); - _futureBusinessCount = MihBusinessDetailsServices().fetchBusinessCount(); - } - - @override - Widget build(BuildContext context) { - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(), - ); - } - - Widget getBody() { - return Stack( - children: [ - MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - aboutHeadings(), - communityCounter(), - callToActionsButtons(), - // mihDivider(), - // womenForChange(), - mihDivider(), - missionAndVission(), - mihDivider(), - founderDetails(), - mihDivider(), - mihSocials(), - ], - ), - ), - Positioned( - right: 10, - bottom: 10, - child: MihFloatingMenu( - icon: Icons.share, - children: [ - SpeedDialChild( - child: Icon( - Icons.android, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Android", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - shareMIHLink( - context, - "Check out the MIH app on the Play Store", - "https://play.google.com/store/apps/details?id=za.co.mzansiinnovationhub.mih", - ); - }, - ), - SpeedDialChild( - child: Icon( - Icons.apple, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "iOS", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - shareMIHLink( - context, - "Check out the MIH app on the App Store", - "https://apps.apple.com/za/app/mzansi-innovation-hub/id6743310890", - ); - }, - ), - SpeedDialChild( - child: Icon( - Icons.store, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Huawei", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - shareMIHLink( - context, - "Check out the MIH app on the App Gallery", - "https://appgallery.huawei.com/app/C113315335?pkgName=za.co.mzansiinnovationhub.mih", - ); - }, - ), - SpeedDialChild( - child: Icon( - Icons.vpn_lock, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Web", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - shareMIHLink( - context, - "Check out the MIH app on the Web", - "https://app.mzansi-innovation-hub.co.za/", - ); - }, - ), - ], - ), - ) - ], - ); - } -} diff --git a/mih_ui/lib/mih_packages/about_mih/package_tools/mih_privacy_policy.dart b/mih_ui/lib/mih_packages/about_mih/package_tools/mih_privacy_policy.dart deleted file mode 100644 index 92e4f575..00000000 --- a/mih_ui/lib/mih_packages/about_mih/package_tools/mih_privacy_policy.dart +++ /dev/null @@ -1,67 +0,0 @@ -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/about_mih/mih_policy_tos_ext/policy_and_terms_text.dart'; -import 'package:flutter/material.dart'; - -class MihPrivacyPolicy extends StatefulWidget { - const MihPrivacyPolicy({super.key}); - - @override - State createState() => _MihPrivacyPolicyState(); -} - -class _MihPrivacyPolicyState extends State { - bool englishOn = true; - @override - Widget build(BuildContext context) { - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(context), - ); - } - - Widget getBody(BuildContext context) { - List children = [ - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - MihButton( - onPressed: () { - setState(() { - englishOn = !englishOn; - }); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - child: Text( - englishOn ? "Simplified Chinese" : "English", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - const SizedBox(height: 10), - ]; - children - .addAll(PolicyAndTermsText().getPrivacyPolicyText(context, englishOn)); - return MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisSize: MainAxisSize.max, - children: children, - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/about_mih/package_tools/mih_terms_of_service.dart b/mih_ui/lib/mih_packages/about_mih/package_tools/mih_terms_of_service.dart deleted file mode 100644 index 435b71ea..00000000 --- a/mih_ui/lib/mih_packages/about_mih/package_tools/mih_terms_of_service.dart +++ /dev/null @@ -1,66 +0,0 @@ -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/about_mih/mih_policy_tos_ext/policy_and_terms_text.dart'; -import 'package:flutter/material.dart'; - -class MIHTermsOfService extends StatefulWidget { - const MIHTermsOfService({super.key}); - - @override - State createState() => _MIHTermsOfServiceState(); -} - -class _MIHTermsOfServiceState extends State { - bool englishOn = true; - @override - Widget build(BuildContext context) { - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(context), - ); - } - - Widget getBody(BuildContext context) { - List children = [ - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - MihButton( - onPressed: () { - setState(() { - englishOn = !englishOn; - }); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - child: Text( - englishOn ? "Simplified Chinese" : "English", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - const SizedBox(height: 10), - ]; - children - .addAll(PolicyAndTermsText().getTermsOfServiceText(context, englishOn)); - return MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - children: children, - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/access_review/builder/build_access_request_list.dart b/mih_ui/lib/mih_packages/access_review/builder/build_access_request_list.dart deleted file mode 100644 index e44e0272..00000000 --- a/mih_ui/lib/mih_packages/access_review/builder/build_access_request_list.dart +++ /dev/null @@ -1,309 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_objects/access_request.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class BuildAccessRequestList extends StatefulWidget { - final List accessRequests; - final AppUser signedInUser; - - const BuildAccessRequestList({ - super.key, - required this.accessRequests, - required this.signedInUser, - }); - - @override - State createState() => _BuildPatientsListState(); -} - -class _BuildPatientsListState extends State { - String baseAPI = AppEnviroment.baseApiUrl; - late double popUpWidth; - late double? popUpheight; - late double popUpButtonWidth; - late double popUpTitleSize; - late double popUpSubtitleSize; - late double popUpBodySize; - late double popUpIconSize; - late double popUpPaddingSize; - late double width; - late double height; - - Future updateAccessAPICall(int index, String accessType) async { - var response = await http.put( - Uri.parse("$baseAPI/access-requests/update/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "business_id": widget.accessRequests[index].business_id, - "app_id": widget.accessRequests[index].app_id, - "date_time": widget.accessRequests[index].date_time, - "access": accessType, - }), - ); - if (response.statusCode == 200) { - //Navigator.of(context).pushNamed('/home'); - Navigator.of(context).pop(); - Navigator.of(context).pop(); - Navigator.of(context).pushNamed( - '/patient-access-review', - arguments: widget.signedInUser, - ); - String message = ""; - if (accessType == "approved") { - message = - "You've successfully approved the access request! ${widget.accessRequests[index].Name} now has access to your profile until ${widget.accessRequests[index].revoke_date.substring(0, 16).replaceAll("T", " ")}."; - } else { - message = - "You've declined the access request. ${widget.accessRequests[index].Name} will not have access to your profile."; - } - MihAlertServices().successBasicAlert( - "Success!", - message, - context, - ); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - Widget displayQueue(int index) { - String line1 = - "Appointment: ${widget.accessRequests[index].date_time.substring(0, 16).replaceAll("T", " ")}"; - String line2 = ""; - line2 += "Requestor: ${widget.accessRequests[index].Name}\n"; - //subtitle += "Business Type: ${widget.accessRequests[index].type}\n"; - String line3 = "Access: "; - String access = ""; - var nowDate = DateTime.now(); - var expireyDate = DateTime.parse(widget.accessRequests[index].revoke_date); - - if (expireyDate.isBefore(nowDate)) { - access += "EXPIRED"; - } else { - access += "${widget.accessRequests[index].access.toUpperCase()}"; - } - String line4 = ""; - if (widget.accessRequests[index].revoke_date.contains("9999")) { - line4 += "Access Expiration date: NOT SET"; - } else { - line4 += - "Access Expiration date: ${widget.accessRequests[index].revoke_date.substring(0, 10)}"; - } - TextSpan accessWithColour; - if (access == "APPROVED") { - accessWithColour = TextSpan( - text: "$access\n", - style: TextStyle( - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"))); - } else if (access == "PENDING") { - accessWithColour = TextSpan( - text: "$access\n", - style: TextStyle( - color: MihColors.getGreyColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"))); - } else { - accessWithColour = TextSpan( - text: "$access\n", - style: TextStyle( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"))); - } - - return ListTile( - title: Text( - line1, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - subtitle: RichText( - text: TextSpan( - text: line2, - style: DefaultTextStyle.of(context).style, - children: [ - TextSpan(text: line3), - accessWithColour, - TextSpan(text: line4), - ]), - ), - // Text( - // subtitle, - // style: TextStyle( - // color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - // ), - onTap: () { - if (access == "CANCELLED") { - MihAlertServices().warningAlert( - "Access Cancelled", - "This appointment has been canceled. As a result, access has been cancelled and the doctor no longer have access to the patient's profile. If you would like them to view the patient's profile again, please book a new appointment through them.", - context, - ); - } else { - viewApprovalPopUp(index); - } - }, - // trailing: Icon( - // Icons.arrow_forward, - // color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - ); - } - - void checkScreenSize() { - if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") { - setState(() { - popUpWidth = (width / 4) * 2; - popUpheight = null; - popUpButtonWidth = 300; - popUpTitleSize = 25.0; - popUpSubtitleSize = 20.0; - popUpBodySize = 15; - popUpPaddingSize = 25.0; - popUpIconSize = 100; - }); - } else { - setState(() { - popUpWidth = width - (width * 0.1); - popUpheight = null; - popUpButtonWidth = 300; - popUpTitleSize = 20.0; - popUpSubtitleSize = 18.0; - popUpBodySize = 15; - popUpPaddingSize = 15.0; - popUpIconSize = 100; - }); - } - } - - void viewApprovalPopUp(int index) { - String subtitle = - "Appointment: ${widget.accessRequests[index].date_time.substring(0, 16).replaceAll("T", " ")}\n"; - subtitle += "Requestor: ${widget.accessRequests[index].Name}\n"; - subtitle += "Business Type: ${widget.accessRequests[index].type}\n\n"; - subtitle += - "You are about to approve an access request to your patient profile.\nPlease be aware that once approved, ${widget.accessRequests[index].Name} will have access to your profile information until ${widget.accessRequests[index].revoke_date.substring(0, 16).replaceAll("T", " ")}.\nIf you are unsure about an upcoming appointment with ${widget.accessRequests[index].Name}, please contact ${widget.accessRequests[index].contact_no} for clarification before approving this request.\n"; - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: "Update Appointment Access", - windowBody: Column( - children: [ - const SizedBox( - height: 10, - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Text( - subtitle, - textAlign: TextAlign.left, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: popUpBodySize, - //fontWeight: FontWeight.bold, - ), - ), - ), - Wrap( - runAlignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - alignment: WrapAlignment.center, - runSpacing: 10, - spacing: 10, - children: [ - MihButton( - onPressed: () { - updateAccessAPICall(index, "declined"); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Decline", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - updateAccessAPICall(index, "approved"); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Approve", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - const SizedBox( - height: 10, - ), - ], - ), - onWindowTapClose: () { - Navigator.pop(context); - }), - ); - } - - @override - void dispose() { - super.dispose(); - } - - @override - Widget build(BuildContext context) { - var size = MediaQuery.of(context).size; - setState(() { - width = size.width; - height = size.height; - }); - checkScreenSize(); - return ListView.separated( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - separatorBuilder: (BuildContext context, index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemCount: widget.accessRequests.length, - itemBuilder: (context, index) { - //final patient = widget.patients[index].id_no.contains(widget.searchString); - //print(index); - return displayQueue(index); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/access_review/builder/build_business_access_list.dart b/mih_ui/lib/mih_packages/access_review/builder/build_business_access_list.dart deleted file mode 100644 index 8743ae25..00000000 --- a/mih_ui/lib/mih_packages/access_review/builder/build_business_access_list.dart +++ /dev/null @@ -1,507 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/patient_access.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_access_controlls_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_access_controls_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:provider/provider.dart'; - -class BuildBusinessAccessList extends StatefulWidget { - final String filterText; - final void Function()? onSuccessUpate; - - const BuildBusinessAccessList({ - super.key, - required this.filterText, - required this.onSuccessUpate, - }); - - @override - State createState() => _BuildPatientsListState(); -} - -class _BuildPatientsListState extends State { - String baseAPI = AppEnviroment.baseApiUrl; - late double popUpWidth; - late double? popUpheight; - late double popUpButtonWidth; - late double popUpTitleSize; - late double popUpSubtitleSize; - late double popUpBodySize; - late double popUpIconSize; - late double popUpPaddingSize; - late double width; - late double height; - - Widget displayQueue( - MzansiProfileProvider mzansiProfileProvider, - MihAccessControllsProvider accessProvider, - int index, - List filteredList) { - String line1 = "Business Name: ${filteredList[index].requested_by}"; - String line2 = ""; - - line2 += - "Request Date: ${filteredList[index].requested_on.substring(0, 16).replaceAll("T", " ")}\n"; - line2 += "Profile Type: ${filteredList[index].type.toUpperCase()}\n"; - //subtitle += "Business Type: ${widget.patientAccessList[index].type}\n"; - String line3 = "Status: "; - String access = filteredList[index].status.toUpperCase(); - - TextSpan accessWithColour; - if (access == "APPROVED") { - accessWithColour = TextSpan( - text: "$access\n", - style: TextStyle( - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"))); - } else if (access == "PENDING") { - accessWithColour = TextSpan( - text: "$access\n", - style: TextStyle( - color: MihColors.getGreyColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"))); - } else { - accessWithColour = TextSpan( - text: "$access\n", - style: TextStyle( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"))); - } - - return ListTile( - title: Text( - line1, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - subtitle: RichText( - text: TextSpan( - text: line2, - style: DefaultTextStyle.of(context).style, - children: [ - TextSpan(text: line3), - accessWithColour, - ]), - ), - // Text( - // subtitle, - // style: TextStyle( - // color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - // ), - onTap: () { - viewApprovalPopUp(mzansiProfileProvider, accessProvider, index); - }, - // trailing: Icon( - // Icons.arrow_forward, - // color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - ); - } - - void checkScreenSize() { - if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") { - setState(() { - popUpWidth = (width / 4) * 2; - popUpheight = null; - popUpButtonWidth = 300; - popUpTitleSize = 25.0; - popUpSubtitleSize = 20.0; - popUpBodySize = 15; - popUpPaddingSize = 25.0; - popUpIconSize = 100; - }); - } else { - setState(() { - popUpWidth = width - (width * 0.1); - popUpheight = null; - popUpButtonWidth = 300; - popUpTitleSize = 20.0; - popUpSubtitleSize = 18.0; - popUpBodySize = 15; - popUpPaddingSize = 15.0; - popUpIconSize = 100; - }); - } - } - - void viewApprovalPopUp(MzansiProfileProvider mzansiProfileProvider, - MihAccessControllsProvider accessProvider, int index) { - String subtitle = - "Business Name: ${accessProvider.accessList![index].requested_by}\n"; - subtitle += - "Requested Date: ${accessProvider.accessList![index].requested_on.substring(0, 16).replaceAll("T", " ")}\n"; - - subtitle += - "Profile Type: ${accessProvider.accessList![index].type.toUpperCase()}\n"; - subtitle += - "Status: ${accessProvider.accessList![index].status.toUpperCase()}"; - if (accessProvider.accessList![index].status == 'pending') { - // "\nYou are about to approve an access request to your patient profile.\nPlease be aware that once approved, ${widget.patientAccessList[index].requested_by} will have access to your profile forever and will be able to contribute to it.\nIf you are unsure about an upcoming appointment with ${widget.patientAccessList[index].requested_by}, please contact *Add Number here* for clarification before approving this request."; - } else { - subtitle += - "\nActioned By: ${accessProvider.accessList![index].approved_by}\n"; - subtitle += - "Actioned On: ${accessProvider.accessList![index].approved_on.substring(0, 16).replaceAll("T", " ")}"; - // subtitle += - // "You have approved this access request to your patient profile.\nPlease be aware that once approved, ${widget.patientAccessList[index].requested_by} will have access to your profile forever and will be able to contribute to it."; - } - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: "Profile Access", - windowBody: Column( - children: [ - const SizedBox( - height: 10, - ), - SizedBox( - width: 1000, - child: Text( - subtitle, - textAlign: TextAlign.left, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: popUpBodySize, - //fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 20.0), - Visibility( - visible: accessProvider.accessList![index].status == 'pending', - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - "Important Notice: Approving Profile Access", - style: TextStyle( - fontWeight: FontWeight.bold, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - Text( - "You are about to accept access to your patient's profile. Please be aware of the following important points:", - style: TextStyle( - fontWeight: FontWeight.normal, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - SizedBox( - width: 700, - child: Text( - "1. Permanent Access: Once you accepts this access request, it will become permanent.", - style: TextStyle( - fontWeight: FontWeight.normal, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - SizedBox( - width: 700, - child: Text( - "2. Shared Information: Any updates make to youe patient profile will be visible to all who have access to the profile.", - style: TextStyle( - fontWeight: FontWeight.normal, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - SizedBox( - width: 700, - child: Text( - "3. Irreversible Access: Once granted, you cannot revoke access to your patient's profile.", - style: TextStyle( - fontWeight: FontWeight.normal, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - Text( - "By pressing the \"Approve\" button you accept the above terms.", - style: TextStyle( - fontWeight: FontWeight.bold, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ], - ), - ), - Visibility( - visible: accessProvider.accessList![index].status == 'approved', - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - "Important Notice: Approved Profile Access", - style: TextStyle( - fontWeight: FontWeight.bold, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - Text( - "You have accepted access to your patient's profile. Please be aware of the following important points:", - style: TextStyle( - fontWeight: FontWeight.normal, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - SizedBox( - width: 700, - child: Text( - "1. Permanent Access: This access is permanent.", - style: TextStyle( - fontWeight: FontWeight.normal, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - SizedBox( - width: 700, - child: Text( - "2. Shared Information: Any updates make to youe patient profile will be visible to all who have access to the profile.", - style: TextStyle( - fontWeight: FontWeight.normal, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - SizedBox( - width: 700, - child: Text( - "3. Irreversible Access: You cannot revoke this access to your patient's profile.", - style: TextStyle( - fontWeight: FontWeight.normal, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - ], - ), - ), - const SizedBox(height: 20.0), - const SizedBox( - height: 20, - ), - Visibility( - visible: accessProvider.accessList![index].status == 'pending', - child: Wrap( - runAlignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - alignment: WrapAlignment.center, - runSpacing: 10, - spacing: 10, - children: [ - MihButton( - onPressed: () async { - print("request declined"); - int statusCode = await MihAccessControlsServices() - .updatePatientAccessAPICall( - accessProvider.accessList![index].business_id, - accessProvider.accessList![index].requested_by, - accessProvider.accessList![index].app_id, - "declined", - "${mzansiProfileProvider.user!.fname} ${mzansiProfileProvider.user!.lname}", - mzansiProfileProvider.user!, - context, - ); - if (statusCode == 200) { - await MihAccessControlsServices() - .getBusinessAccessListOfPatient( - mzansiProfileProvider.user!.app_id, - accessProvider, - ); - context.pop(); - successPopUp("Successfully Actioned Request", - "You have successfully Declined access request"); - } else { - MihAlertServices().internetConnectionAlert(context); - } - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Decline", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () async { - print("request approved"); - int statusCode = await MihAccessControlsServices() - .updatePatientAccessAPICall( - accessProvider.accessList![index].business_id, - accessProvider.accessList![index].requested_by, - accessProvider.accessList![index].app_id, - "approved", - "${mzansiProfileProvider.user!.fname} ${mzansiProfileProvider.user!.lname}", - mzansiProfileProvider.user!, - context, - ); - if (statusCode == 200) { - await MihAccessControlsServices() - .getBusinessAccessListOfPatient( - mzansiProfileProvider.user!.app_id, - accessProvider, - ); - context.pop(); - successPopUp("Successfully Actioned Request", - "You have successfully Accepted access request"); - } else { - MihAlertServices().internetConnectionAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Approve", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - ], - ), - onWindowTapClose: () { - Navigator.pop(context); - }), - ); - } - - void successPopUp(String title, String message) { - MihAlertServices().successAdvancedAlert( - title, - message, - [ - MihButton( - onPressed: () { - context.pop(); - KenLogger.warning("dismissing pop up and refreshing list"); - if (widget.onSuccessUpate != null) { - widget.onSuccessUpate!(); - } - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - List filterAccessList(List accessList) { - if (widget.filterText == "All") { - return accessList; - } - return accessList - .where((item) => - item.status.toLowerCase() == widget.filterText.toLowerCase()) - .toList(); - } - - @override - void dispose() { - super.dispose(); - } - - @override - Widget build(BuildContext context) { - var size = MediaQuery.of(context).size; - setState(() { - width = size.width; - height = size.height; - }); - checkScreenSize(); - return Consumer2( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, - MihAccessControllsProvider accessProvider, - Widget? child) { - return ListView.separated( - separatorBuilder: (BuildContext context, index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemCount: filterAccessList(accessProvider.accessList!).length, - itemBuilder: (context, index) { - //final patient = widget.patients[index].id_no.contains(widget.searchString); - //print(index); - final filteredList = filterAccessList(accessProvider.accessList!); - return displayQueue( - mzansiProfileProvider, accessProvider, index, filteredList); - }, - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/access_review/mih_access.dart b/mih_ui/lib/mih_packages/access_review/mih_access.dart deleted file mode 100644 index 329ac58b..00000000 --- a/mih_ui/lib/mih_packages/access_review/mih_access.dart +++ /dev/null @@ -1,111 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_access_controlls_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/access_review/package_tools/mih_access_requests.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_data_helper_services.dart'; -import 'package:provider/provider.dart'; - -class MihAccess extends StatefulWidget { - const MihAccess({ - super.key, - }); - - @override - State createState() => _MihAccessState(); -} - -class _MihAccessState extends State { - bool _isLoadingInitialData = true; - late final MihAccessRequest _accessRequest; - - Future _loadInitialData() async { - setState(() { - _isLoadingInitialData = true; - }); - MzansiProfileProvider mzansiProfileProvider = - context.read(); - if (mzansiProfileProvider.user == null) { - await MihDataHelperServices().loadUserDataOnly( - mzansiProfileProvider, - ); - } - setState(() { - _isLoadingInitialData = false; - }); - } - - @override - void initState() { - super.initState(); - _accessRequest = MihAccessRequest(); - _loadInitialData(); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, MihAccessControllsProvider accessProvider, - Widget? child) { - if (_isLoadingInitialData) { - return Scaffold( - body: Center( - child: Mihloadingcircle(), - ), - ); - } - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: getToolTitle(), - selectedbodyIndex: accessProvider.toolIndex, - onIndexChange: (newValue) { - accessProvider.setToolIndex(newValue); - }, - ); - }, - ); - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - context.goNamed( - 'mihHome', - ); - FocusScope.of(context).unfocus(); - }, - ); - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.people)] = () { - context.read().setToolIndex(0); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: context.watch().toolIndex, - ); - } - - List getToolBody() { - return [ - _accessRequest, - ]; - } - - List getToolTitle() { - List toolTitles = [ - "Access", - ]; - return toolTitles; - } -} diff --git a/mih_ui/lib/mih_packages/access_review/package_tile/mih_access_tile.dart b/mih_ui/lib/mih_packages/access_review/package_tile/mih_access_tile.dart deleted file mode 100644 index 759ee745..00000000 --- a/mih_ui/lib/mih_packages/access_review/package_tile/mih_access_tile.dart +++ /dev/null @@ -1,46 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihAccessTile extends StatefulWidget { - final double packageSize; - - const MihAccessTile({ - super.key, - required this.packageSize, - }); - - @override - State createState() => _MihAccessTileState(); -} - -class _MihAccessTileState extends State { - @override - Widget build(BuildContext context) { - return MihPackageTile( - authenticateUser: true, - onTap: () { - context.goNamed( - "mihAccess", - ); - // Navigator.of(context).pushNamed( - // '/mih-access', - // arguments: widget.signedInUser, - // ); - }, - appName: "Access Controls", - appIcon: Icon( - MihIcons.accessControl, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // size: widget.packageSize, - ), - iconSize: widget.packageSize, - textColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } -} diff --git a/mih_ui/lib/mih_packages/access_review/package_tools/mih_access_requests.dart b/mih_ui/lib/mih_packages/access_review/package_tools/mih_access_requests.dart deleted file mode 100644 index 241fce12..00000000 --- a/mih_ui/lib/mih_packages/access_review/package_tools/mih_access_requests.dart +++ /dev/null @@ -1,186 +0,0 @@ -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/mih_objects/patient_access.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_access_controlls_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_packages/access_review/builder/build_business_access_list.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_access_controls_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class MihAccessRequest extends StatefulWidget { - const MihAccessRequest({ - super.key, - }); - - @override - State createState() => _MihAccessRequestState(); -} - -class _MihAccessRequestState extends State { - TextEditingController filterController = TextEditingController(); - bool isLoading = true; - String baseUrl = AppEnviroment.baseApiUrl; - - String errorCode = ""; - String errorBody = ""; - String datefilter = ""; - String accessFilter = ""; - bool forceRefresh = false; - late String selectedDropdown; - - List filterSearchResults(List accessList) { - List templist = []; - for (var item in accessList) { - if (filterController.text == "All") { - templist.add(item); - } else { - if (item.status.contains(filterController.text.toLowerCase())) { - templist.add(item); - } - } - } - return templist; - } - - void refreshList() { - MzansiProfileProvider mzansiProfileProvider = - context.read(); - MihAccessControllsProvider accessProvider = - context.read(); - if (forceRefresh == true) { - MihAccessControlsServices().getBusinessAccessListOfPatient( - mzansiProfileProvider.user!.app_id, - accessProvider, - ); - setState(() { - forceRefresh = false; - }); - } else if (selectedDropdown != filterController.text) { - MihAccessControlsServices().getBusinessAccessListOfPatient( - mzansiProfileProvider.user!.app_id, - accessProvider, - ); - setState(() { - selectedDropdown = filterController.text; - }); - } - } - - Widget getBody() { - return Consumer2( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, - MihAccessControllsProvider accessProvider, - Widget? child) { - if (isLoading) { - return const Center( - child: Mihloadingcircle(), - ); - } - return Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.max, - children: [ - Flexible( - child: MihDropdownField( - controller: filterController, - hintText: "Access Type", - dropdownOptions: const [ - "All", - "Approved", - "Pending", - "Declined", - "Cancelled", - ], - requiredText: true, - editable: true, - enableSearch: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - ), - IconButton( - iconSize: 35, - onPressed: () { - setState(() { - forceRefresh = true; - }); - KenLogger.warning("Refreshing Access List"); - refreshList(); - }, - icon: const Icon( - Icons.refresh, - ), - ), - ], - ), - const SizedBox(height: 10), - Expanded( - child: BuildBusinessAccessList( - filterText: filterController.text, - onSuccessUpate: () { - setState(() { - forceRefresh = true; - }); - refreshList(); - }, - ), - ), - ], - ); - }, - ); - } - - Future initiasizeAccessList() async { - MzansiProfileProvider mzansiProfileProvider = - context.read(); - MihAccessControllsProvider accessProvider = - context.read(); - setState(() { - isLoading = true; - }); - await MihAccessControlsServices().getBusinessAccessListOfPatient( - mzansiProfileProvider.user!.app_id, - accessProvider, - ); - setState(() { - isLoading = false; - }); - } - - @override - void dispose() { - filterController.dispose(); - super.dispose(); - } - - @override - void initState() { - selectedDropdown = "All"; - filterController.text = "All"; - filterController.addListener(refreshList); - WidgetsBinding.instance.addPostFrameCallback((_) async { - await initiasizeAccessList(); - }); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return MihPackageToolBody( - borderOn: false, - innerHorizontalPadding: 10, - bodyItem: getBody(), - ); - } -} diff --git a/mih_ui/lib/mih_packages/calculator/mih_calculator.dart b/mih_ui/lib/mih_packages/calculator/mih_calculator.dart deleted file mode 100644 index e80bdb0a..00000000 --- a/mih_ui/lib/mih_packages/calculator/mih_calculator.dart +++ /dev/null @@ -1,102 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_calculator_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/calculator/package_tools/currency_exchange_rate.dart'; -import 'package:mzansi_innovation_hub/mih_packages/calculator/package_tools/simple_calc.dart'; -import 'package:mzansi_innovation_hub/mih_packages/calculator/package_tools/tip_calc.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_currency_exchange_rate_services.dart'; -import 'package:provider/provider.dart'; - -class MIHCalculator extends StatefulWidget { - const MIHCalculator({ - super.key, - }); - - @override - State createState() => _MIHCalculatorState(); -} - -class _MIHCalculatorState extends State { - late final SimpleCalc _simpleCalc; - late final TipCalc _tipCalc; - late final CurrencyExchangeRate _currencyExchangeRate; - - Future getCurrencyCodeList() async { - await MihCurrencyExchangeRateServices.getCurrencyCodeList(context); - } - - @override - void initState() { - super.initState(); - _simpleCalc = SimpleCalc(); - _tipCalc = TipCalc(); - _currencyExchangeRate = CurrencyExchangeRate(); - WidgetsBinding.instance.addPostFrameCallback((_) async { - await getCurrencyCodeList(); - }); - } - - @override - Widget build(BuildContext context) { - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: getToolTitle(), - selectedbodyIndex: context.watch().toolIndex, - onIndexChange: (newIndex) { - context.read().setToolIndex(newIndex); - }, - ); - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - context.goNamed( - 'mihHome', - ); - FocusScope.of(context).unfocus(); - }, - ); - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.calculate)] = () { - context.read().setToolIndex(0); - }; - temp[const Icon(Icons.money)] = () { - context.read().setToolIndex(1); - }; - temp[const Icon(Icons.currency_exchange)] = () { - context.read().setToolIndex(2); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: context.watch().toolIndex, - ); - } - - List getToolBody() { - return [ - _simpleCalc, - _tipCalc, - _currencyExchangeRate, - ]; - } - - List getToolTitle() { - List toolTitles = [ - "Simple Calculator", - "Tip Calculator", - "Forex Calculator", - ]; - return toolTitles; - } -} diff --git a/mih_ui/lib/mih_packages/calculator/package_tiles/mih_calculator_tile.dart b/mih_ui/lib/mih_packages/calculator/package_tiles/mih_calculator_tile.dart deleted file mode 100644 index 6aa393b1..00000000 --- a/mih_ui/lib/mih_packages/calculator/package_tiles/mih_calculator_tile.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihCalculatorTile extends StatefulWidget { - final double packageSize; - - const MihCalculatorTile({ - super.key, - required this.packageSize, - }); - - @override - State createState() => _MihCalculatorTileState(); -} - -class _MihCalculatorTileState extends State { - @override - Widget build(BuildContext context) { - return MihPackageTile( - onTap: () { - context.goNamed( - "mihCalculator", - ); - }, - appName: "Calculator", - appIcon: Icon( - MihIcons.calculator, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // size: widget.packageSize, - ), - iconSize: widget.packageSize, - textColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } -} diff --git a/mih_ui/lib/mih_packages/calculator/package_tools/currency_exchange_rate.dart b/mih_ui/lib/mih_packages/calculator/package_tools/currency_exchange_rate.dart deleted file mode 100644 index 6ae8bbb7..00000000 --- a/mih_ui/lib/mih_packages/calculator/package_tools/currency_exchange_rate.dart +++ /dev/null @@ -1,451 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/gestures.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_banner_ad.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_calculator_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_currency_exchange_rate_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:provider/provider.dart'; - -class CurrencyExchangeRate extends StatefulWidget { - const CurrencyExchangeRate({super.key}); - - @override - State createState() => _CurrencyExchangeRateState(); -} - -class _CurrencyExchangeRateState extends State { - final _formKey = GlobalKey(); - final TextEditingController _fromCurrencyController = TextEditingController(); - final TextEditingController _toCurrencyController = TextEditingController(); - final TextEditingController _fromAmountController = TextEditingController(); - final TextEditingController _toAmountController = TextEditingController(); - - Future submitForm() async { - String fromCurrencyCode = _fromCurrencyController.text.split(" - ")[0]; - String toCurrencyCode = _toCurrencyController.text.split(" - ")[0]; - List dateValue = []; - double exchangeRate = 0; - await MihCurrencyExchangeRateServices.getCurrencyExchangeValue( - fromCurrencyCode, toCurrencyCode) - .then((amount) { - dateValue = amount; - }); - exchangeRate = double.parse(dateValue[1]); - double exchangeValue = - double.parse(_fromAmountController.text) * exchangeRate; - - print( - "Date: ${dateValue[0]}\n${_fromAmountController.text} | $fromCurrencyCode\n$exchangeValue | $toCurrencyCode"); - displayResult(dateValue[0], _fromAmountController.text, fromCurrencyCode, - exchangeValue, toCurrencyCode); - } - - void clearInput() { - _fromCurrencyController.clear(); - _fromAmountController.clear(); - _toCurrencyController.clear(); - _toAmountController.clear(); - } - - void displayResult(String date, String amount, String fromCurrencyCode, - double exchangeValue, String toCurrencyCode) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: "Calculation Results", - onWindowTapClose: () { - Navigator.pop(context); - }, - windowBody: Column( - children: [ - Icon( - Icons.currency_exchange, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 20), - FittedBox( - child: Text( - "Values as at $date", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ), - const SizedBox(height: 10), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - child: Text( - amount, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - const SizedBox(width: 10), - Expanded( - child: Text( - fromCurrencyCode.toUpperCase(), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - ], - ), - const Divider(), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - child: Text( - exchangeValue.toStringAsFixed(2), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - const SizedBox(width: 10), - Expanded( - child: Text( - toCurrencyCode.toUpperCase(), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - ], - ), - SizedBox(height: 10), - Consumer(builder: (context, bannerAdDisplay, child) { - if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) { - return MihBannerAd(); - } else { - return const SizedBox(height: 0); - } - }), - ], - ), - ), - ); - } - - void displayDisclaimer() { - final String companyName = 'Mzansi Innovation Hub'; - - showDialog( - barrierDismissible: false, - context: context, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: "Disclaimer Notice", - onWindowTapClose: () { - Navigator.pop(context); - }, - windowBody: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Main Title - - Text( - 'Disclaimer of Warranty and Limitation of Liability for Forex Calculator', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - ), - - const SizedBox(height: 24.0), - - // First Paragraph - using RichText to bold "the Tool" - _buildRichText( - 'The Forex Calculator feature ("', - 'the Tool', - '") is provided on an "as is" and "as available" basis. It is an experimental feature and is intended solely for informational and illustrative purposes.', - ), - const SizedBox(height: 16.0), - - // Second Paragraph - Text( - '$companyName makes no representations or warranties of any kind, express or implied, as to the accuracy, completeness, reliability, or suitability of the information and calculations generated by the Tool. All exchange rates and results are estimates and are subject to change without notice.', - style: TextStyle( - fontSize: 15, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.normal, - ), - ), - const SizedBox(height: 16.0), - - // Third Paragraph - Text( - 'The information provided by the Tool should not be construed as financial, investment, trading, or any other form of advice. You should not make any financial decisions based solely on the output of this Tool. We expressly recommend that you seek independent professional advice and verify all data with a qualified financial advisor and/or through alternative, reliable market data sources before executing any foreign exchange transactions.', - style: TextStyle( - fontSize: 15, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.normal, - ), - ), - const SizedBox(height: 16.0), - - // Fourth Paragraph - Text( - 'By using the Tool, you agree that $companyName, its affiliates, directors, and employees shall not be held liable for any direct, indirect, incidental, special, consequential, or exemplary damages, including but not limited to, damages for loss of profits, goodwill, use, data, or other intangible losses, resulting from: (i) the use or the inability to use the Tool; (ii) any inaccuracies, errors, or omissions in the Tool\'s calculations or data; or (iii) any reliance placed by you on the information provided by the Tool.', - style: TextStyle( - fontSize: 15, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.normal, - ), - ), - ], - ), - ), - ); - } - - Widget _buildRichText(String start, String bold, String end) { - return RichText( - text: TextSpan( - style: TextStyle( - fontSize: 15, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.normal, - ), - children: [ - TextSpan(text: start), - TextSpan( - text: bold, style: const TextStyle(fontWeight: FontWeight.bold)), - TextSpan(text: end), - ], - ), - ); - } - - @override - void dispose() { - super.dispose(); - _fromCurrencyController.dispose(); - _fromAmountController.dispose(); - _toCurrencyController.dispose(); - _toAmountController.dispose(); - } - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - innerHorizontalPadding: 10, - bodyItem: getBody(screenWidth), - ); - } - - Widget getBody(double width) { - return Consumer( - builder: (context, calculatorProvider, child) { - return MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0.075), - child: Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: _fromAmountController, - multiLineInput: false, - requiredText: true, - hintText: "Currency Amount", - numberMode: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihDropdownField( - controller: _fromCurrencyController, - hintText: "From", - dropdownOptions: calculatorProvider.availableCurrencies, - editable: true, - enableSearch: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - requiredText: true, - ), - const SizedBox(height: 10), - MihDropdownField( - controller: _toCurrencyController, - hintText: "To", - dropdownOptions: calculatorProvider.availableCurrencies, - editable: true, - enableSearch: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - requiredText: true, - ), - const SizedBox(height: 15), - RichText( - textAlign: TextAlign.left, - text: TextSpan( - style: TextStyle( - fontSize: 15, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - children: [ - const TextSpan( - text: "* Experimental Feature: Please review "), - TextSpan( - text: "Diclaimer", - style: TextStyle( - decoration: TextDecoration.underline, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - ), - recognizer: TapGestureRecognizer() - ..onTap = () { - displayDisclaimer(); - }, - ), - const TextSpan(text: " before use."), - ], - ), - ), - const SizedBox(height: 25), - Center( - child: Wrap( - runAlignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - alignment: WrapAlignment.center, - spacing: 10, - runSpacing: 10, - children: [ - MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - submitForm(); - FocusScope.of(context) - .requestFocus(FocusNode()); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Calculate", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - clearInput(); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Clear", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ], - ), - ], - ), - ), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/calculator/package_tools/simple_calc.dart b/mih_ui/lib/mih_packages/calculator/package_tools/simple_calc.dart deleted file mode 100644 index 1d2c148d..00000000 --- a/mih_ui/lib/mih_packages/calculator/package_tools/simple_calc.dart +++ /dev/null @@ -1,385 +0,0 @@ -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:flutter/material.dart'; -import 'package:math_expressions/math_expressions.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class SimpleCalc extends StatefulWidget { - const SimpleCalc({super.key}); - - @override - State createState() => _SimpleCalcState(); -} - -class _SimpleCalcState extends State { - var userInput = ''; - var answer = '0'; - - // Array of button - final List buttons = [ - 'AC', - '(', - ')', - '÷', - '7', - '8', - '9', - 'x', - '4', - '5', - '6', - '-', - '1', - '2', - '3', - '+', - '0', - '.', - 'D', - '=', - ]; - -// function to calculate the input operation - void equalPressed() { - String finaluserinput = userInput; - finaluserinput = finaluserinput.replaceAll('x', '*'); - finaluserinput = finaluserinput.replaceAll('÷', '/'); - print(finaluserinput); - - Parser p = Parser(); - Expression exp = p.parse(finaluserinput); - ContextModel cm = ContextModel(); - double eval = exp.evaluate(EvaluationType.REAL, cm); - if (eval.toString().length <= 1) { - } else if (eval - .toString() - .substring(eval.toString().length - 2, eval.toString().length) == - ".0") { - answer = eval.toString().substring(0, eval.toString().length - 2); - } else { - answer = eval.toString(); - } - } - - bool isNumeric(String? s) { - if (s == null) { - return false; - } - return double.tryParse(s) != null; - } - - @override - Widget build(BuildContext context) { - return MihPackageToolBody( - borderOn: false, - innerHorizontalPadding: 10, - bodyItem: getBody(), - ); - } - - Widget getBody() { - // double width = MediaQuery.sizeOf(context).width; - double height = MediaQuery.sizeOf(context).height; - // var padding = MediaQuery.paddingOf(context); - // double newheight = height - padding.top - padding.bottom; - // print("width: $width"); - // print("height: $height"); - // print("newheight: $newheight"); - double calcWidth = 500; - if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") { - if (height < 700) { - calcWidth = 300; - } - } - return MihSingleChildScroll( - scrollbarOn: true, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Container( - padding: const EdgeInsets.all(20), - alignment: Alignment.centerRight, - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - reverse: true, - child: Text( - userInput, - style: TextStyle( - fontSize: 40, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ), - ), - Container( - width: double.infinity, - //color: Colors.white, - padding: const EdgeInsets.all(15), - alignment: Alignment.centerRight, - child: Text( - answer, - style: TextStyle( - fontSize: 30, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold), - ), - ), - Container( - alignment: Alignment.centerRight, - child: SizedBox( - width: calcWidth, - child: GridView.builder( - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - // padding: EdgeInsets.only( - // left: width / 10, - // right: width / 10, - // bottom: height / 15, - // //top: 20, - // ), - // shrinkWrap: true, - itemCount: buttons.length, - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 4, - //mainAxisExtent: 150, - ), - itemBuilder: (context, index) { - // Clear Button - if (index == 0) { - return Padding( - padding: const EdgeInsets.all(4.0), - child: MihButton( - onPressed: () { - setState(() { - userInput = ''; - answer = '0'; - }); - }, - buttonColor: MihColors.getPurpleColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 50, - height: 50, - borderRadius: 5, - child: Text( - buttons[index], - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ); - } - - // ( button - else if (index == 1) { - return Padding( - padding: const EdgeInsets.all(4.0), - child: MihButton( - onPressed: () { - setState(() { - userInput += buttons[index]; - }); - }, - buttonColor: MihColors.getGreyColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 50, - height: 50, - borderRadius: 5, - child: Text( - buttons[index], - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ); - } - // ) Button - else if (index == 2) { - return Padding( - padding: const EdgeInsets.all(4.0), - child: MihButton( - onPressed: () { - setState(() { - userInput += buttons[index]; - }); - }, - buttonColor: MihColors.getGreyColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 50, - height: 50, - borderRadius: 5, - child: Text( - buttons[index], - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ); - } - // +, -, / x buttons - else if (index == 3 || - index == 7 || - index == 11 || - index == 15) { - return Padding( - padding: const EdgeInsets.all(4.0), - child: MihButton( - onPressed: () { - if (answer == "0") { - setState(() { - userInput += buttons[index]; - }); - } else { - setState(() { - // userInput = answer; - // answer = "0"; - userInput += buttons[index]; - }); - } - }, - buttonColor: MihColors.getGreyColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 50, - height: 50, - borderRadius: 5, - child: Text( - buttons[index], - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ); - } - - // delete Button - else if (index == 18) { - return Padding( - padding: const EdgeInsets.all(4.0), - child: MihButton( - onPressed: () { - setState(() { - if (userInput.length == 1) { - userInput = '0'; - } else if (userInput.length > 1) { - userInput = - userInput.substring(0, userInput.length - 1); - } - if (!isNumeric(userInput[userInput.length - 1])) { - userInput = - userInput.substring(0, userInput.length - 1); - } - equalPressed(); - }); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 50, - height: 50, - borderRadius: 5, - child: Icon( - Icons.backspace, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ); - } - // Equal_to Button - else if (index == 19) { - return Padding( - padding: const EdgeInsets.all(4.0), - child: MihButton( - onPressed: () { - setState(() { - equalPressed(); - userInput = answer; - }); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 50, - height: 50, - borderRadius: 5, - child: Text( - buttons[index], - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ); - } - // other buttons - else { - return Padding( - padding: const EdgeInsets.all(4.0), - child: MihButton( - onPressed: () { - setState(() { - userInput += buttons[index]; - equalPressed(); - }); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 50, - height: 50, - borderRadius: 5, - child: Text( - buttons[index], - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ); - } - }, - ), - ), - ), - ], - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/calculator/package_tools/tip_calc.dart b/mih_ui/lib/mih_packages/calculator/package_tools/tip_calc.dart deleted file mode 100644 index 49ce484c..00000000 --- a/mih_ui/lib/mih_packages/calculator/package_tools/tip_calc.dart +++ /dev/null @@ -1,453 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/foundation.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_banner_ad.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_numeric_stepper.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:math_expressions/math_expressions.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_toggle.dart'; -import 'package:provider/provider.dart'; - -class TipCalc extends StatefulWidget { - const TipCalc({super.key}); - - @override - State createState() => _TipCalcState(); -} - -class _TipCalcState extends State { - TextEditingController billAmountController = TextEditingController(); - TextEditingController tipPercentageController = TextEditingController(); - TextEditingController splitBillController = TextEditingController(); - TextEditingController noPeopleController = TextEditingController(); - final ValueNotifier splitValue = ValueNotifier(""); - late bool splitPosition; - final _formKey = GlobalKey(); - String tip = ""; - String total = ""; - String amountPerPerson = ""; - String temp = ""; - void splitSelected() { - if (splitBillController.text.isNotEmpty) { - splitValue.value = splitBillController.text; - } else { - splitValue.value = ""; - } - } - - void validateInput() async { - calculatePressed(); - } - - void calculatePressed() { - String tipCalc = - "${billAmountController.text}*(${tipPercentageController.text}/100)"; - Parser p = Parser(); - ContextModel cm = ContextModel(); - Expression exp = p.parse(tipCalc); - double eval = exp.evaluate(EvaluationType.REAL, cm); - tip = eval.toStringAsFixed(2); - //print("Tip: $tip"); - String totalCalc = "${billAmountController.text}+$tip"; - exp = p.parse(totalCalc); - eval = exp.evaluate(EvaluationType.REAL, cm); - total = eval.toStringAsFixed(2); - //print("Total Amount: $total"); - if (splitBillController.text == "Yes") { - String splitCalc = "$total/${noPeopleController.text}"; - exp = p.parse(splitCalc); - eval = exp.evaluate(EvaluationType.REAL, cm); - amountPerPerson = eval.toStringAsFixed(2); - } - - //print("Amount Per Person: $amountPerPerson"); - displayResult(); - } - - void clearInput() { - billAmountController.clear(); - tipPercentageController.clear(); - noPeopleController.clear(); - setState(() { - splitBillController.text = "No"; - }); - } - - @override - void dispose() { - billAmountController.dispose(); - tipPercentageController.dispose(); - splitBillController.dispose(); - noPeopleController.dispose(); - super.dispose(); - } - - void displayResult() { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: "Calculation Results", - onWindowTapClose: () { - Navigator.pop(context); - }, - windowBody: Column( - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FaIcon( - FontAwesomeIcons.coins, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - size: 35, - ), - const SizedBox(width: 15), - Text( - "Tip", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ], - ), - Text( - tip, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const Divider(), - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FaIcon( - FontAwesomeIcons.moneyBills, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - size: 35, - ), - const SizedBox(width: 15), - Text( - "Total", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ], - ), - Text( - total, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - Text( - "~ ${double.parse(total).ceil()}.00", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - if (splitBillController.text == "Yes") const Divider(), - if (splitBillController.text == "Yes") - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FaIcon( - FontAwesomeIcons.peopleGroup, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - size: 35, - ), - const SizedBox(width: 15), - Text( - "Total per Person", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ], - ), - if (splitBillController.text == "Yes") - Text( - amountPerPerson, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - if (splitBillController.text == "Yes") - Text( - "~ ${double.parse(amountPerPerson).ceil()}.00", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - SizedBox(height: 10), - Consumer(builder: (context, bannerAdDisplay, child) { - if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) { - return MihBannerAd(); - } else { - return const SizedBox(height: 0); - } - }), - // if (splitBillController.text == "Yes") const Divider(), - ], - ), - ), - ); - } - - @override - void initState() { - super.initState(); - splitBillController.text = "No"; - noPeopleController.text = "2"; - splitPosition = false; - splitBillController.addListener(splitSelected); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - innerHorizontalPadding: 10, - bodyItem: getBody(screenWidth), - ); - } - - Widget getBody(double width) { - return MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0.075), - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - MihForm( - formKey: _formKey, - formFields: [ - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: billAmountController, - multiLineInput: false, - requiredText: true, - hintText: "Bill Amount", - numberMode: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: tipPercentageController, - multiLineInput: false, - requiredText: true, - hintText: "Tip Percentage", - numberMode: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihToggle( - hintText: "Split Bill", - initialPostion: splitPosition, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - secondaryFillColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onChange: (value) { - setState(() { - splitBillController.text = value ? "Yes" : "No"; - splitPosition = value; - if (value) { - noPeopleController.text = - noPeopleController.text.isEmpty - ? "2" - : noPeopleController.text; - } else { - noPeopleController.clear(); - } - }); - // if (value) { - // setState(() { - // splitBillController.text = "Yes"; - // splitPosition = value; - // }); - // } else { - // setState(() { - // splitBillController.text = "No"; - // splitPosition = value; - // }); - // } - }, - ), - ValueListenableBuilder( - valueListenable: splitValue, - builder: (BuildContext context, String value, Widget? child) { - temp = value; - return Visibility( - visible: temp == "Yes", - child: Column( - children: [ - MihNumericStepper( - controller: noPeopleController, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - hintText: "No. People", - requiredText: temp == "Yes", - minValue: 2, - // maxValue: 5, - validationOn: true, - ), - // MihTextFormField( - // fillColor: MzansiInnovationHub.of(context)! - // .theme - // .secondaryColor(), - // inputColor: MzansiInnovationHub.of(context)! - // .theme - // .primaryColor(), - // controller: noPeopleController, - // multiLineInput: false, - // requiredText: temp == "Yes", - // hintText: "No. of People", - // numberMode: true, - // validator: (validationValue) { - // if (temp == "Yes") { - // return MihValidationServices() - // .isEmpty(validationValue); - // } else { - // return null; - // } - // }, - // ), - const SizedBox(height: 10), - ], - ), - ); - }, - ), - const SizedBox(height: 10), - Center( - child: Wrap( - runAlignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - alignment: WrapAlignment.center, - spacing: 10, - runSpacing: 10, - children: [ - MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - validateInput(); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Calculate", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - clearInput(); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Clear", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ], - ), - ], - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/calendar/builder/build_access_request_list.dart b/mih_ui/lib/mih_packages/calendar/builder/build_access_request_list.dart deleted file mode 100644 index 53f22147..00000000 --- a/mih_ui/lib/mih_packages/calendar/builder/build_access_request_list.dart +++ /dev/null @@ -1,309 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/access_request.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class BuildAccessRequestList extends StatefulWidget { - final List accessRequests; - final AppUser signedInUser; - - const BuildAccessRequestList({ - super.key, - required this.accessRequests, - required this.signedInUser, - }); - - @override - State createState() => _BuildPatientsListState(); -} - -class _BuildPatientsListState extends State { - String baseAPI = AppEnviroment.baseApiUrl; - late double popUpWidth; - late double? popUpheight; - late double popUpButtonWidth; - late double popUpTitleSize; - late double popUpSubtitleSize; - late double popUpBodySize; - late double popUpIconSize; - late double popUpPaddingSize; - late double width; - late double height; - - Future updateAccessAPICall(int index, String accessType) async { - var response = await http.put( - Uri.parse("$baseAPI/access-requests/update/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "business_id": widget.accessRequests[index].business_id, - "app_id": widget.accessRequests[index].app_id, - "date_time": widget.accessRequests[index].date_time, - "access": accessType, - }), - ); - if (response.statusCode == 200) { - //Navigator.of(context).pushNamed('/home'); - Navigator.of(context).pop(); - Navigator.of(context).pop(); - Navigator.of(context).pushNamed( - '/patient-access-review', - arguments: widget.signedInUser, - ); - String message = ""; - if (accessType == "approved") { - message = - "You've successfully approved the access request! ${widget.accessRequests[index].Name} now has access to your profile until ${widget.accessRequests[index].revoke_date.substring(0, 16).replaceAll("T", " ")}."; - } else { - message = - "You've declined the access request. ${widget.accessRequests[index].Name} will not have access to your profile."; - } - MihAlertServices().successBasicAlert( - "Success!", - message, - context, - ); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - Widget displayQueue(int index) { - String line1 = - "Appointment: ${widget.accessRequests[index].date_time.substring(0, 16).replaceAll("T", " ")}"; - String line2 = ""; - line2 += "Requestor: ${widget.accessRequests[index].Name}\n"; - //subtitle += "Business Type: ${widget.accessRequests[index].type}\n"; - String line3 = "Access: "; - String access = ""; - var nowDate = DateTime.now(); - var expireyDate = DateTime.parse(widget.accessRequests[index].revoke_date); - - if (expireyDate.isBefore(nowDate)) { - access += "EXPIRED"; - } else { - access += "${widget.accessRequests[index].access.toUpperCase()}"; - } - String line4 = ""; - if (widget.accessRequests[index].revoke_date.contains("9999")) { - line4 += "Access Expiration date: NOT SET"; - } else { - line4 += - "Access Expiration date: ${widget.accessRequests[index].revoke_date.substring(0, 10)}"; - } - TextSpan accessWithColour; - if (access == "APPROVED") { - accessWithColour = TextSpan( - text: "$access\n", - style: TextStyle( - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"))); - } else if (access == "PENDING") { - accessWithColour = TextSpan( - text: "$access\n", - style: TextStyle( - color: MihColors.getGreyColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"))); - } else { - accessWithColour = TextSpan( - text: "$access\n", - style: TextStyle( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"))); - } - - return ListTile( - title: Text( - line1, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - subtitle: RichText( - text: TextSpan( - text: line2, - style: DefaultTextStyle.of(context).style, - children: [ - TextSpan(text: line3), - accessWithColour, - TextSpan(text: line4), - ]), - ), - // Text( - // subtitle, - // style: TextStyle( - // color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - // ), - onTap: () { - if (access == "CANCELLED") { - MihAlertServices().warningAlert( - "Access Cancelled", - "This appointment has been canceled. As a result, access has been cancelled and the doctor no longer have access to the patient's profile. If you would like them to view the patient's profile again, please book a new appointment through them.", - context, - ); - } else { - viewApprovalPopUp(index); - } - }, - // trailing: Icon( - // Icons.arrow_forward, - // color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - ); - } - - void checkScreenSize() { - if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") { - setState(() { - popUpWidth = (width / 4) * 2; - popUpheight = null; - popUpButtonWidth = 300; - popUpTitleSize = 25.0; - popUpSubtitleSize = 20.0; - popUpBodySize = 15; - popUpPaddingSize = 25.0; - popUpIconSize = 100; - }); - } else { - setState(() { - popUpWidth = width - (width * 0.1); - popUpheight = null; - popUpButtonWidth = 300; - popUpTitleSize = 20.0; - popUpSubtitleSize = 18.0; - popUpBodySize = 15; - popUpPaddingSize = 15.0; - popUpIconSize = 100; - }); - } - } - - void viewApprovalPopUp(int index) { - String subtitle = - "Appointment: ${widget.accessRequests[index].date_time.substring(0, 16).replaceAll("T", " ")}\n"; - subtitle += "Requestor: ${widget.accessRequests[index].Name}\n"; - subtitle += "Business Type: ${widget.accessRequests[index].type}\n\n"; - subtitle += - "You are about to approve an access request to your patient profile.\nPlease be aware that once approved, ${widget.accessRequests[index].Name} will have access to your profile information until ${widget.accessRequests[index].revoke_date.substring(0, 16).replaceAll("T", " ")}.\nIf you are unsure about an upcoming appointment with ${widget.accessRequests[index].Name}, please contact ${widget.accessRequests[index].contact_no} for clarification before approving this request.\n"; - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: "Update Appointment Access", - windowBody: Column( - children: [ - const SizedBox( - height: 10, - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Text( - subtitle, - textAlign: TextAlign.left, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: popUpBodySize, - //fontWeight: FontWeight.bold, - ), - ), - ), - Wrap( - runAlignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - alignment: WrapAlignment.center, - runSpacing: 10, - spacing: 10, - children: [ - MihButton( - onPressed: () { - updateAccessAPICall(index, "declined"); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Decline", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - updateAccessAPICall(index, "approved"); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Approve", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - const SizedBox( - height: 10, - ), - ], - ), - onWindowTapClose: () { - Navigator.pop(context); - }), - ); - } - - @override - void dispose() { - super.dispose(); - } - - @override - Widget build(BuildContext context) { - var size = MediaQuery.of(context).size; - setState(() { - width = size.width; - height = size.height; - }); - checkScreenSize(); - return ListView.separated( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - separatorBuilder: (BuildContext context, index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemCount: widget.accessRequests.length, - itemBuilder: (context, index) { - //final patient = widget.patients[index].id_no.contains(widget.searchString); - //print(index); - return displayQueue(index); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/calendar/builder/build_appointment_list.dart b/mih_ui/lib/mih_packages/calendar/builder/build_appointment_list.dart deleted file mode 100644 index 669c97f9..00000000 --- a/mih_ui/lib/mih_packages/calendar/builder/build_appointment_list.dart +++ /dev/null @@ -1,765 +0,0 @@ -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/appointment.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_calendar_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_date_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_time_field.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class BuildAppointmentList extends StatefulWidget { - final bool inWaitingRoom; - final TextEditingController titleController; - final TextEditingController descriptionIDController; - final TextEditingController? patientIdController; - final TextEditingController dateController; - final TextEditingController timeController; - - const BuildAppointmentList({ - super.key, - required this.inWaitingRoom, - required this.titleController, - required this.descriptionIDController, - required this.patientIdController, - required this.dateController, - required this.timeController, - }); - - @override - State createState() => _BuildAppointmentListState(); -} - -class _BuildAppointmentListState extends State { - String baseAPI = AppEnviroment.baseApiUrl; - TextEditingController patientIdController = TextEditingController(); - TextEditingController dateController = TextEditingController(); - TextEditingController timeController = TextEditingController(); - TextEditingController idController = TextEditingController(); - TextEditingController fnameController = TextEditingController(); - TextEditingController lnameController = TextEditingController(); - TextEditingController daysExtensionController = TextEditingController(); - final _formKey = GlobalKey(); - int counter = 0; - late double width; - late double height; - - void clearControllers() { - widget.titleController.clear(); - widget.descriptionIDController.clear(); - widget.dateController.clear(); - widget.timeController.clear(); - } - - double getPaddingSize() { - if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") { - return (width / 10); - } else { - return 0.0; - } - } - - Widget displayAppointment(MzansiProfileProvider mzansiProfileProvider, - MihCalendarProvider mihCalendarProvider, int index, double bodyWidth) { - List appointmentList = mzansiProfileProvider.personalHome - ? mihCalendarProvider.personalAppointments! - : mihCalendarProvider.businessAppointments!; - - // SAFELY EXTRACT DATE AND TIME - String dateTimeString = appointmentList[index].date_time; - String timePart = ""; - String datePart = ""; - - if (dateTimeString.contains("T")) { - List parts = dateTimeString.split('T'); - datePart = parts[0]; - timePart = parts[1].substring(0, 5); - } else if (dateTimeString.contains(" ")) { - List parts = dateTimeString.split(' '); - datePart = parts[0]; - timePart = parts[1].substring(0, 5); - } else { - // Fallback if format is unexpected - datePart = dateTimeString; - timePart = "00:00"; - } - - String heading = - "$timePart - ${appointmentList[index].title.toUpperCase()}"; - String description = appointmentList[index].description; - - DateTime now = DateTime.now(); - int hourNow = int.parse(now.toString().split(' ')[1].substring(0, 2)); - String currentDate = - DateTime(now.year, now.month, now.day).toString().split(' ')[0]; - - int appointHour = int.parse(timePart.split(':')[0]); - - Color appointmentColor = MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - - if (currentDate == datePart) { - if (appointHour < hourNow) { - appointmentColor = MihColors.getGreyColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } else if (appointHour == hourNow) { - appointmentColor = MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } - } else if (DateTime.parse(datePart).isBefore(DateTime.parse(currentDate))) { - appointmentColor = MihColors.getGreyColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } - - return Container( - decoration: BoxDecoration( - border: Border.all( - width: 3.0, - color: appointmentColor, - ), - borderRadius: BorderRadius.circular(20)), - child: ListTile( - title: Text( - heading, - style: TextStyle( - color: appointmentColor, - fontWeight: FontWeight.bold, - ), - ), - subtitle: Text( - description, - style: TextStyle( - color: appointmentColor, - overflow: TextOverflow.ellipsis, - ), - ), - onTap: () { - // SAFELY SET CONTROLLER VALUES - setState(() { - widget.titleController.text = appointmentList[index].title; - widget.descriptionIDController.text = - appointmentList[index].description; - widget.dateController.text = datePart; - widget.timeController.text = timePart; - }); - - if (widget.inWaitingRoom == false) { - appointmentDetailsWindow( - mzansiProfileProvider, mihCalendarProvider, index, bodyWidth); - } else { - waitingRoomAppointmentDetailsWindow( - mzansiProfileProvider, mihCalendarProvider, index, bodyWidth); - } - }, - ), - ); - } - - void appointmentDetailsWindow(MzansiProfileProvider mzansiProfileProvider, - MihCalendarProvider mihCalendarProvider, int index, double bodyWidth) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: "Appointment Details", - menuOptions: [ - SpeedDialChild( - child: Icon( - Icons.edit, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Edit Appointment", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - appointmentUpdateWindow(mzansiProfileProvider, - mihCalendarProvider, index, bodyWidth); - }, - ), - SpeedDialChild( - child: Icon( - Icons.delete, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Delete Appointment", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - deleteAppointmentConfirmationWindow( - mzansiProfileProvider, mihCalendarProvider, index); - }, - ), - ], - onWindowTapClose: () { - context.pop(); - clearControllers(); - }, - windowBody: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.05) - : const EdgeInsets.symmetric(horizontal: 0), - child: Column( - children: [ - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: widget.titleController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Appointment Title", - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: widget.dateController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Date", - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: widget.timeController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Time", - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: widget.descriptionIDController, - multiLineInput: true, - height: 250, - requiredText: true, - readOnly: true, - hintText: "Appointment Description", - ), - const SizedBox(height: 10), - ], - ), - ), - ); - }, - ); - } - - void waitingRoomAppointmentDetailsWindow( - MzansiProfileProvider mzansiProfileProvider, - MihCalendarProvider mihCalendarProvider, - int index, - double bodyWidth) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: "Appointment Details", - menuOptions: [ - SpeedDialChild( - child: Icon( - Icons.edit, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Edit Appointment", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - appointmentUpdateWindow(mzansiProfileProvider, - mihCalendarProvider, index, bodyWidth); - }, - ), - SpeedDialChild( - child: Icon( - Icons.delete, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Delete Appointment", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - deleteAppointmentConfirmationWindow( - mzansiProfileProvider, mihCalendarProvider, index); - }, - ), - ], - onWindowTapClose: () { - context.pop(); - clearControllers(); - }, - windowBody: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.05) - : const EdgeInsets.symmetric(horizontal: 0), - child: Column( - children: [ - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: widget.titleController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Appointment Title", - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: widget.dateController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Date", - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: widget.timeController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Time", - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: widget.descriptionIDController, - multiLineInput: true, - height: 250, - requiredText: true, - readOnly: true, - hintText: "Appointment Description", - ), - const SizedBox(height: 10), - // SizedBox( - // // width: 500, - // child: MIHTextField( - // controller: widget.titleController, - // hintText: "Patient ID Number", - // editable: false, - // required: false, - // ), - // ), - // const SizedBox(height: 10), - ], - ), - ), - ); - }, - ); - } - - void appointmentUpdateWindow(MzansiProfileProvider mzansiProfileProvider, - MihCalendarProvider mihCalendarProvider, int index, double bodyWidth) { - List appointmentList = mzansiProfileProvider.personalHome - ? mihCalendarProvider.personalAppointments! - : mihCalendarProvider.businessAppointments!; - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: "Update Appointment", - onWindowTapClose: () { - setState(() { - widget.titleController.text = appointmentList[index].title; - widget.descriptionIDController.text = - appointmentList[index].description; - widget.dateController.text = - appointmentList[index].date_time.split('T')[0]; - widget.timeController.text = appointmentList[index] - .date_time - .split('T')[1] - .substring(0, 5); - }); - context.pop(); - }, - windowBody: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.05) - : const EdgeInsets.symmetric(horizontal: 0), - child: Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: widget.titleController, - multiLineInput: false, - requiredText: true, - hintText: "Appointment Title", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihDateField( - controller: widget.dateController, - labelText: "Date", - required: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTimeField( - controller: widget.timeController, - labelText: "Time", - required: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: widget.descriptionIDController, - multiLineInput: true, - height: 250, - requiredText: true, - hintText: "Appointment Description", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 20), - Center( - child: Wrap( - runAlignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - alignment: WrapAlignment.center, - runSpacing: 10, - spacing: 10, - children: [ - MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - updateAppointmentCall(mzansiProfileProvider, - mihCalendarProvider, index); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Update", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ], - ), - ], - ), - ), - ); - }, - ); - } - - bool isAppointmentInputValid() { - if (widget.dateController.text.isEmpty || - widget.timeController.text.isEmpty) { - return false; - } else { - return true; - } - } - - void deleteAppointmentConfirmationWindow( - MzansiProfileProvider mzansiProfileProvider, - MihCalendarProvider mihCalendarProvider, - int index) { - MihAlertServices().deleteConfirmationAlert( - "This appointment will be deleted permanently from your calendar. Are you certain you want to delete it?", - () { - deleteAppointmentCall( - mzansiProfileProvider, mihCalendarProvider, index); - }, - context, - ); - } - - Future updateAppointmentCall( - MzansiProfileProvider mzansiProfileProvider, - MihCalendarProvider mihCalendarProvider, - int index) async { - int statusCode; - if (isAppointmentInputValid()) { - List appointmentList = mzansiProfileProvider.personalHome - ? mihCalendarProvider.personalAppointments! - : mihCalendarProvider.businessAppointments!; - KenLogger.success("ersonalHome: ${mzansiProfileProvider.personalHome}"); - if (mzansiProfileProvider.personalHome == true) { - statusCode = await MihMzansiCalendarApis.updatePersonalAppointment( - mzansiProfileProvider.user!, - mzansiProfileProvider.business, - null, - appointmentList[index].idappointments, - widget.titleController.text, - widget.descriptionIDController.text, - widget.dateController.text, - widget.timeController.text, - mihCalendarProvider, - context, - ); - } else if (mzansiProfileProvider.personalHome == false && - widget.inWaitingRoom == false) { - statusCode = await MihMzansiCalendarApis.updateBusinessAppointment( - mzansiProfileProvider.user!, - mzansiProfileProvider.business, - mzansiProfileProvider.businessUser, - appointmentList[index].idappointments, - widget.titleController.text, - widget.descriptionIDController.text, - widget.dateController.text, - widget.timeController.text, - mihCalendarProvider, - context, - ); - } else { - statusCode = await MihMzansiCalendarApis.updatePatientAppointment( - mzansiProfileProvider.user!, - mzansiProfileProvider.business, - mzansiProfileProvider.businessUser, - appointmentList[index].idappointments, - widget.titleController.text, - widget.descriptionIDController.text, - widget.dateController.text, - widget.timeController.text, - context, - ); - } - if (statusCode == 200) { - context.pop(); - context.pop(); - successPopUp("Successfully Updated Appointment", - "You appointment has been successfully updated."); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } else { - MihAlertServices().inputErrorAlert(context); - } - } - - Future deleteAppointmentCall( - MzansiProfileProvider mzansiProfileProvider, - MihCalendarProvider mihCalendarProvider, - int index) async { - List appointmentList = mzansiProfileProvider.personalHome - ? mihCalendarProvider.personalAppointments! - : mihCalendarProvider.businessAppointments!; - int statucCode = await MihMzansiCalendarApis.deleteAppointmentAPICall( - mzansiProfileProvider.user!, - mzansiProfileProvider.personalHome, - mzansiProfileProvider.business, - mzansiProfileProvider.businessUser, - widget.inWaitingRoom, - appointmentList[index].idappointments, - mihCalendarProvider, - context, - ); - if (statucCode == 200) { - context.pop(); - context.pop(); - clearControllers(); - // successPopUp("Successfully Deleted Appointment", - // "You appointment has been successfully deleted from your calendar."); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - void successPopUp(String title, String message) { - MihAlertServices().successAdvancedAlert( - title, - message, - [ - MihButton( - onPressed: () { - clearControllers(); - Navigator.of(context).pop(); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - bool canEditAppointment(MzansiProfileProvider mzansiProfileProvider, - MihCalendarProvider mihCalendarProvider, int index) { - List appointmentList = mzansiProfileProvider.personalHome - ? mihCalendarProvider.personalAppointments! - : mihCalendarProvider.businessAppointments!; - if (mzansiProfileProvider.personalHome == true && - appointmentList[index].app_id == mzansiProfileProvider.user!.app_id && - appointmentList[index].business_id == "") { - return true; - } else if (mzansiProfileProvider.personalHome == false && - appointmentList[index].business_id == - mzansiProfileProvider.business!.business_id && - appointmentList[index].app_id.isEmpty) { - return true; - } else if (mzansiProfileProvider.personalHome == false && - appointmentList[index].business_id == - mzansiProfileProvider.business!.business_id && - appointmentList[index].app_id.isNotEmpty) { - return true; - } else { - return false; - } - } - - @override - void dispose() { - daysExtensionController.dispose(); - dateController.dispose(); - timeController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - var size = MediaQuery.of(context).size; - setState(() { - width = size.width; - height = size.height; - }); - return Consumer2( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, - MihCalendarProvider mihCalendarProvider, - Widget? child) { - // List appointmentList = mzansiProfileProvider.personalHome - // ? mihCalendarProvider.personalAppointments! - // : mihCalendarProvider.businessAppointments!; - return Padding( - padding: EdgeInsets.symmetric(horizontal: getPaddingSize()), - child: ListView.builder( - itemCount: mzansiProfileProvider.personalHome - ? mihCalendarProvider.personalAppointments!.length - : mihCalendarProvider.businessAppointments!.length, - itemBuilder: (context, index) { - return displayAppointment( - mzansiProfileProvider, mihCalendarProvider, index, width); - }, - ), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/calendar/builder/build_queue_list.dart b/mih_ui/lib/mih_packages/calendar/builder/build_queue_list.dart deleted file mode 100644 index bef838a1..00000000 --- a/mih_ui/lib/mih_packages/calendar/builder/build_queue_list.dart +++ /dev/null @@ -1,101 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_objects/patient_queue.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; - -class BuildQueueList extends StatefulWidget { - final List patientQueue; - final AppUser signedInUser; - - const BuildQueueList({ - super.key, - required this.patientQueue, - required this.signedInUser, - }); - - @override - State createState() => _BuildQueueListState(); -} - -class _BuildQueueListState extends State { - String baseAPI = AppEnviroment.baseApiUrl; - TextEditingController dateController = TextEditingController(); - TextEditingController timeController = TextEditingController(); - TextEditingController idController = TextEditingController(); - TextEditingController fnameController = TextEditingController(); - TextEditingController lnameController = TextEditingController(); - TextEditingController daysExtensionController = TextEditingController(); - int counter = 0; - - Widget displayQueue(int index) { - String title = widget.patientQueue[index].business_name.toUpperCase(); - // widget.patientQueue[index].date_time.split('T')[1].substring(0, 5); - String line234 = ""; - // var nowDate = DateTime.now(); - // var expireyDate = DateTime.parse(widget.patientQueue[index].revoke_date); - - line234 += - widget.patientQueue[index].date_time.split('T')[1].substring(0, 5); - - return ListTile( - title: Text( - title, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - subtitle: RichText( - text: TextSpan( - text: "Time: $line234", - style: DefaultTextStyle.of(context).style, - // children: [ - // TextSpan(text: line5), - // accessWithColour, - // TextSpan(text: line6), - // ] - ), - ), - onTap: () {}, - ); - } - - bool isAccessExpired(String accessType) { - if (accessType == "EXPIRED") { - return true; - } else { - return false; - } - } - - @override - void dispose() { - daysExtensionController.dispose(); - dateController.dispose(); - timeController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return ListView.separated( - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - separatorBuilder: (BuildContext context, index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemCount: widget.patientQueue.length, - itemBuilder: (context, index) { - //final patient = widget.patients[index].id_no.contains(widget.searchString); - //print(index); - - return displayQueue(index); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/calendar/mzansi_calendar.dart b/mih_ui/lib/mih_packages/calendar/mzansi_calendar.dart deleted file mode 100644 index 66199e12..00000000 --- a/mih_ui/lib/mih_packages/calendar/mzansi_calendar.dart +++ /dev/null @@ -1,115 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/calendar/package_tools/appointments.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_data_helper_services.dart'; -import 'package:provider/provider.dart'; - -class MzansiCalendar extends StatefulWidget { - const MzansiCalendar({ - super.key, - }); - - @override - State createState() => _MzansiCalendarState(); -} - -class _MzansiCalendarState extends State { - bool _isLoadingInitialData = true; - late final Appointments _appointments; - - Future _loadInitialData() async { - setState(() { - _isLoadingInitialData = true; - }); - MzansiProfileProvider mzansiProfileProvider = - context.read(); - if (mzansiProfileProvider.user == null) { - await MihDataHelperServices().loadUserDataOnly( - mzansiProfileProvider, - ); - } - setState(() { - _isLoadingInitialData = false; - }); - } - - @override - void initState() { - super.initState(); - _appointments = Appointments(); - _loadInitialData(); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, MihCalendarProvider calendarProvider, - Widget? child) { - if (_isLoadingInitialData) { - return Scaffold( - body: Center( - child: Mihloadingcircle(), - ), - ); - } - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: getToolTitle(), - selectedbodyIndex: calendarProvider.toolIndex, - onIndexChange: (newIndex) { - calendarProvider.setToolIndex(newIndex); - }, - ); - }, - ); - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - context.read().resetSelectedDay(); - context.goNamed( - 'mihHome', - ); - FocusScope.of(context).unfocus(); - }, - ); - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.calendar_month)] = () { - context.read().setToolIndex(0); - }; - - return MihPackageTools( - tools: temp, - selcetedIndex: context.watch().toolIndex, - ); - } - - List getToolBody() { - return [ - _appointments, - ]; - } - - List getToolTitle() { - MzansiProfileProvider mzansiProfileProvider = - context.read(); - List toolTitles = [ - mzansiProfileProvider.personalHome == true ? "Personal" : "Business", - ]; - return toolTitles; - } -} diff --git a/mih_ui/lib/mih_packages/calendar/package_tiles/mzansi_calendar_tile.dart b/mih_ui/lib/mih_packages/calendar/package_tiles/mzansi_calendar_tile.dart deleted file mode 100644 index f29fff14..00000000 --- a/mih_ui/lib/mih_packages/calendar/package_tiles/mzansi_calendar_tile.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MzansiCalendarTile extends StatefulWidget { - final double packageSize; - - const MzansiCalendarTile({ - super.key, - required this.packageSize, - }); - - @override - State createState() => _MzansiCalendarTileState(); -} - -class _MzansiCalendarTileState extends State { - @override - Widget build(BuildContext context) { - return MihPackageTile( - onTap: () { - context.goNamed( - "mihCalendar", - ); - // Navigator.of(context).pushNamed( - // '/calendar', - // arguments: widget.arguments, - // ); - }, - appName: "Calendar", - appIcon: Icon( - MihIcons.calendar, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // size: widget.packageSize, - ), - iconSize: widget.packageSize, - textColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } -} diff --git a/mih_ui/lib/mih_packages/calendar/package_tools/appointments.dart b/mih_ui/lib/mih_packages/calendar/package_tools/appointments.dart deleted file mode 100644 index ab0967e2..00000000 --- a/mih_ui/lib/mih_packages/calendar/package_tools/appointments.dart +++ /dev/null @@ -1,484 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_calendar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_calendar_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_date_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_time_field.dart'; -import 'package:mzansi_innovation_hub/mih_objects/appointment.dart'; -import 'package:mzansi_innovation_hub/mih_packages/calendar/builder/build_appointment_list.dart'; -import 'package:provider/provider.dart'; - -class Appointments extends StatefulWidget { - const Appointments({ - super.key, - }); - - @override - State createState() => _PatientAccessRequestState(); -} - -class _PatientAccessRequestState extends State { - TextEditingController selectedAppointmentDateController = - TextEditingController(); - final TextEditingController _appointmentTitleController = - TextEditingController(); - final TextEditingController _appointmentDescriptionIDController = - TextEditingController(); - final TextEditingController _appointmentDateController = - TextEditingController(); - final TextEditingController _appointmentTimeController = - TextEditingController(); - - bool isLoading = true; - final _formKey = GlobalKey(); - - Widget displayAppointmentList(MzansiProfileProvider mzansiProfileProvider, - MihCalendarProvider mihCalendarProvider) { - List appointmentList = mzansiProfileProvider.personalHome - ? mihCalendarProvider.personalAppointments! - : mihCalendarProvider.businessAppointments!; - - return appointmentList.isNotEmpty - ? Expanded( - child: BuildAppointmentList( - inWaitingRoom: false, - titleController: _appointmentTitleController, - descriptionIDController: _appointmentDescriptionIDController, - patientIdController: null, - dateController: _appointmentDateController, - timeController: _appointmentTimeController, - ), - ) - : Expanded( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.calendar, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "No appointments for ${mihCalendarProvider.selectedDay}", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - Icons.menu, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - TextSpan( - text: - " to add an appointment or select a different date"), - ], - ), - ), - ), - ], - ), - ), - ); - } - - void addAppointmentWindow(MzansiProfileProvider mzansiProfileProvider, - MihCalendarProvider mihCalendarProvider, double width) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: "Add Appointment", - onWindowTapClose: () { - context.pop(); - _appointmentDateController.clear(); - _appointmentTimeController.clear(); - _appointmentTitleController.clear(); - _appointmentDescriptionIDController.clear(); - }, - windowBody: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.05) - : const EdgeInsets.symmetric(horizontal: 0), - child: Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: _appointmentTitleController, - multiLineInput: false, - requiredText: true, - hintText: "Appointment Title", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihDateField( - controller: _appointmentDateController, - labelText: "Date", - required: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTimeField( - controller: _appointmentTimeController, - labelText: "Time", - required: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: _appointmentDescriptionIDController, - multiLineInput: true, - height: 250, - requiredText: true, - hintText: "Appointment Description", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 20), - Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - addAppointmentCall( - mzansiProfileProvider, mihCalendarProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Add", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ], - ), - ), - ); - }, - ); - } - - bool isAppointmentInputValid() { - if (_appointmentTitleController.text.isEmpty || - _appointmentDescriptionIDController.text.isEmpty || - _appointmentDateController.text.isEmpty || - _appointmentTimeController.text.isEmpty) { - return false; - } else { - return true; - } - } - - Future addAppointmentCall( - MzansiProfileProvider mzansiProfileProvider, - MihCalendarProvider mihCalendarProvider, - ) async { - if (isAppointmentInputValid()) { - int statusCode; - if (mzansiProfileProvider.personalHome == false) { - statusCode = await MihMzansiCalendarApis.addBusinessAppointment( - mzansiProfileProvider.user!, - mzansiProfileProvider.business!, - mzansiProfileProvider.businessUser!, - false, - _appointmentTitleController.text, - _appointmentDescriptionIDController.text, - _appointmentDateController.text, - _appointmentTimeController.text, - mihCalendarProvider, - context, - ); - } else { - statusCode = await MihMzansiCalendarApis.addPersonalAppointment( - mzansiProfileProvider.user!, - _appointmentTitleController.text, - _appointmentDescriptionIDController.text, - _appointmentDateController.text, - _appointmentTimeController.text, - mihCalendarProvider, - context, - ); - } - if (statusCode == 201) { - context.pop(); - successPopUp("Successfully Added Appointment", - "You appointment has been successfully added to your calendar."); - if (mzansiProfileProvider.personalHome == true) { - await MihMzansiCalendarApis.getPersonalAppointments( - mzansiProfileProvider.user!.app_id, - mihCalendarProvider.selectedDay, - mihCalendarProvider, - ); - } else { - await MihMzansiCalendarApis.getBusinessAppointments( - mzansiProfileProvider.business!.business_id, - false, - mihCalendarProvider.selectedDay, - mihCalendarProvider, - ); - } - } else { - MihAlertServices().internetConnectionAlert(context); - } - } else { - MihAlertServices().inputErrorAlert(context); - } - checkforchange(); - } - - void successPopUp(String title, String message) { - MihAlertServices().successAdvancedAlert( - title, - message, - [ - MihButton( - onPressed: () { - context.pop(); - setState(() { - _appointmentDateController.clear(); - _appointmentTimeController.clear(); - _appointmentTitleController.clear(); - _appointmentDescriptionIDController.clear(); - }); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - String getTitle(MzansiProfileProvider mzansiProfileProvider) { - if (mzansiProfileProvider.personalHome == false) { - return "Business Appointments"; - } else { - return "Personal Appointments"; - } - } - - void checkforchange() { - setState(() { - isLoading = true; - }); - _loadInitialAppointments(); - } - - Widget getBody(double width) { - if (isLoading) { - return const Center( - child: Mihloadingcircle(), - ); - } - return Consumer2( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, - MihCalendarProvider mihCalendarProvider, - Widget? child) { - return Stack( - children: [ - Column( - children: [ - MIHCalendar( - calendarWidth: 500, - rowHeight: 35, - setDate: (value) { - mihCalendarProvider.setSelectedDay(value); - setState(() { - selectedAppointmentDateController.text = value; - }); - }), - // Divider( - // color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - displayAppointmentList( - mzansiProfileProvider, - mihCalendarProvider, - ) - ], - ), - Positioned( - right: 10, - bottom: 10, - child: MihFloatingMenu( - icon: Icons.add, - animatedIcon: AnimatedIcons.menu_close, - children: [ - SpeedDialChild( - child: Icon( - Icons.add, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - label: "Add Appointment", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - addAppointmentWindow( - mzansiProfileProvider, mihCalendarProvider, width); - }, - ) - ], - ), - ), - ], - ); - }, - ); - } - - Future _loadInitialAppointments() async { - MzansiProfileProvider mzansiProfileProvider = - context.read(); - MihCalendarProvider mihCalendarProvider = - context.read(); - if (mzansiProfileProvider.personalHome == false) { - await MihMzansiCalendarApis.getBusinessAppointments( - mzansiProfileProvider.business!.business_id, - false, - mihCalendarProvider.selectedDay, - mihCalendarProvider, - ); - } else { - await MihMzansiCalendarApis.getPersonalAppointments( - mzansiProfileProvider.user!.app_id, - mihCalendarProvider.selectedDay, - mihCalendarProvider, - ); - } - setState(() { - isLoading = false; - }); - } - - @override - void dispose() { - selectedAppointmentDateController.dispose(); - _appointmentDateController.dispose(); - _appointmentTimeController.dispose(); - _appointmentTitleController.dispose(); - _appointmentDescriptionIDController.dispose(); - super.dispose(); - } - - @override - void initState() { - selectedAppointmentDateController.addListener(checkforchange); - WidgetsBinding.instance.addPostFrameCallback((_) async { - _loadInitialAppointments(); - }); - super.initState(); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(screenWidth), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mih_authentication/mih_auth_forgot_password.dart b/mih_ui/lib/mih_packages/mih_authentication/mih_auth_forgot_password.dart deleted file mode 100644 index 5ed9cad9..00000000 --- a/mih_ui/lib/mih_packages/mih_authentication/mih_auth_forgot_password.dart +++ /dev/null @@ -1,73 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/package_tools/mih_forgot_password.dart'; - -class MihAuthForgotPassword extends StatefulWidget { - const MihAuthForgotPassword({super.key}); - - @override - State createState() => _MihAuthForgotPasswordState(); -} - -class _MihAuthForgotPasswordState extends State { - int _selcetedIndex = 0; - late final MihForgotPassword _forgotPassword; - - @override - void initState() { - super.initState(); - _forgotPassword = MihForgotPassword(); - } - - @override - Widget build(BuildContext context) { - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appToolTitles: ["Forgot Password"], - appBody: getToolBody(), - selectedbodyIndex: _selcetedIndex, - onIndexChange: (newValue) { - setState(() { - _selcetedIndex = newValue; - }); - }, - ); - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - context.goNamed( - 'mihHome', - extra: true, - ); - FocusScope.of(context).unfocus(); - }, - ); - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.question_mark_rounded)] = () { - setState(() { - _selcetedIndex = 0; - }); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: _selcetedIndex, - ); - } - - List getToolBody() { - return [ - _forgotPassword, - ]; - } -} diff --git a/mih_ui/lib/mih_packages/mih_authentication/mih_auth_password_reset.dart b/mih_ui/lib/mih_packages/mih_authentication/mih_auth_password_reset.dart deleted file mode 100644 index a458cbd3..00000000 --- a/mih_ui/lib/mih_packages/mih_authentication/mih_auth_password_reset.dart +++ /dev/null @@ -1,81 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/package_tools/mih_reset_password.dart'; - -class MihAuthPasswordReset extends StatefulWidget { - final String token; - const MihAuthPasswordReset({ - super.key, - required this.token, - }); - - @override - State createState() => _MihAuthPasswordResetState(); -} - -class _MihAuthPasswordResetState extends State { - int _selcetedIndex = 0; - late final MihResetPassword _resetPassword; - - @override - void initState() { - super.initState(); - _resetPassword = MihResetPassword(token: widget.token); - } - - @override - Widget build(BuildContext context) { - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: ["Reset Password"], - selectedbodyIndex: _selcetedIndex, - onIndexChange: (newValue) { - setState(() { - _selcetedIndex = newValue; - }); - }, - ); - } - - Widget getAction() { - return Padding( - padding: const EdgeInsets.only(left: 5.0), - child: MihPackageAction( - icon: const Icon(MihIcons.mihLogo), - iconSize: 45, - onTap: () { - context.goNamed( - 'mihHome', - extra: true, - ); - FocusScope.of(context).unfocus(); - }, - ), - ); - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.password_rounded)] = () { - setState(() { - _selcetedIndex = 0; - }); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: _selcetedIndex, - ); - } - - List getToolBody() { - return [ - _resetPassword, - ]; - } -} diff --git a/mih_ui/lib/mih_packages/mih_authentication/mih_authentication.dart b/mih_ui/lib/mih_packages/mih_authentication/mih_authentication.dart deleted file mode 100644 index adbd4139..00000000 --- a/mih_ui/lib/mih_packages/mih_authentication/mih_authentication.dart +++ /dev/null @@ -1,85 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_authentication_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/package_tools/mih_register.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/package_tools/mih_sign_in.dart'; -import 'package:provider/provider.dart'; - -class MihAuthentication extends StatefulWidget { - const MihAuthentication({super.key}); - - @override - State createState() => _MihAuthenticationState(); -} - -class _MihAuthenticationState extends State { - late final MihSignIn _signIn; - late final MihRegister _register; - - @override - void initState() { - super.initState(); - _signIn = MihSignIn(); - _register = MihRegister(); - } - - @override - Widget build(BuildContext context) { - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: getToolTitle(), - selectedbodyIndex: context.watch().toolIndex, - onIndexChange: (newIndex) { - context.read().setToolIndex(newIndex); - }, - ); - } - - List getToolBody() { - return [ - _signIn, - _register, - ]; - } - - List getToolTitle() { - List toolTitles = [ - "Sign In", - "Create an Account", - ]; - return toolTitles; - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.perm_identity)] = () { - context.read().setToolIndex(0); - }; - temp[const Icon(Icons.create)] = () { - context.read().setToolIndex(1); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: context.watch().toolIndex, - ); - } - - Widget getAction() { - return Padding( - padding: const EdgeInsets.only(left: 5.0), - child: MihPackageAction( - icon: const Icon(MihIcons.mihLogo), - iconSize: 45, - onTap: () { - context.goNamed("aboutMih", extra: true); - }, - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mih_authentication/package_tools/mih_forgot_password.dart b/mih_ui/lib/mih_packages/mih_authentication/package_tools/mih_forgot_password.dart deleted file mode 100644 index b4406da8..00000000 --- a/mih_ui/lib/mih_packages/mih_authentication/package_tools/mih_forgot_password.dart +++ /dev/null @@ -1,227 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_authentication_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; - -class MihForgotPassword extends StatefulWidget { - const MihForgotPassword({super.key}); - - @override - State createState() => _MihForgotPasswordState(); -} - -class _MihForgotPasswordState extends State { - final emailController = TextEditingController(); - bool successfulForgotPassword = false; - final _formKey = GlobalKey(); - final FocusNode _focusNode = FocusNode(); - bool acceptWarning = false; - - Future submitPasswodReset() async { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - try { - var resetPassEmailSent = await MihAuthenticationServices() - .forgotPassword(emailController.text); - context.pop(); - if (resetPassEmailSent) { - setState(() { - successfulForgotPassword = true; - }); - } - } on Exception { - //loginError(); - } - } - - void prePassResteWarning() { - MihAlertServices().successAdvancedAlert( - "Password Reset Confirmation", - "Before you reset your password, please be aware that you'll receive an email with a link to confirm your identity and set a new password. Make sure to check your inbox, including spam or junk folders. If you don't receive the email within a few minutes, please try resending the reset request.", - [ - MihButton( - onPressed: () { - setState(() { - acceptWarning = true; - }); - context.pop(); - validateInput(); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Continue", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - void resetLinkSentSuccessfully() { - MihAlertServices().successAdvancedAlert( - "Successfully Sent Reset Link", - "We've sent a password reset link to your email address. Please check your inbox, including spam or junk folders.\n\nOnce you find the email, click on the link to reset your password.\n\nIf you don't receive the email within a few minutes, please try resending the reset request.\n\nThe reset link will expire after 2 hours", - [ - MihButton( - onPressed: () { - context.goNamed( - 'mihHome', - extra: true, - ); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - void validateInput() async { - if (emailController.text.isEmpty) { - MihAlertServices().inputErrorAlert(context); - } else { - await submitPasswodReset(); - if (successfulForgotPassword) { - // Navigator.of(context).pushNamedAndRemoveUntil('/', (route) => false); - resetLinkSentSuccessfully(); - } - } - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(screenWidth), - ); - } - - Widget getBody(double width) { - return KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - validateInput(); - } - }, - child: MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: MzansiInnovationHub.of(context)!.theme.screenType == - "desktop" - ? EdgeInsets.symmetric(vertical: 25, horizontal: width * 0.2) - : EdgeInsets.symmetric(vertical: 25, horizontal: width * 0.075), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - //logo - Icon( - Icons.lock, - size: 100, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - //spacer - const SizedBox(height: 10), - //Heading - Text( - 'Forgot Password', - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 25), - MihForm( - formKey: _formKey, - formFields: [ - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: emailController, - multiLineInput: false, - requiredText: true, - hintText: "Email", - validator: (value) { - return MihValidationServices().validateEmail(value); - }, - ), - //spacer - const SizedBox(height: 20), - Align( - alignment: Alignment.center, - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - prePassResteWarning(); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Reset Password", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ], - ), - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mih_authentication/package_tools/mih_register.dart b/mih_ui/lib/mih_packages/mih_authentication/package_tools/mih_register.dart deleted file mode 100644 index f6555b88..00000000 --- a/mih_ui/lib/mih_packages/mih_authentication/package_tools/mih_register.dart +++ /dev/null @@ -1,358 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_authentication_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:provider/provider.dart'; -import 'package:supertokens_flutter/http.dart' as http; -import 'package:supertokens_flutter/supertokens.dart'; - -class MihRegister extends StatefulWidget { - const MihRegister({ - super.key, - }); - - @override - State createState() => _MihRegisterState(); -} - -class _MihRegisterState extends State { - final emailController = TextEditingController(); - final passwordController = TextEditingController(); - final confirmPasswordController = TextEditingController(); - final FocusNode _focusNode = FocusNode(); - final _formKey = GlobalKey(); - final baseAPI = AppEnviroment.baseApiUrl; - - Future addUserAPICall(String email, String uid) async { - //await getOfficeIdByUser(docOfficeIdApiUrl + widget.userEmail); - //print(futureDocOfficeId.toString()); - await MihUserServices().createUser( - email, - uid, - context, - ); - // var response = await http.post( - // Uri.parse("$baseAPI/user/insert/"), - // headers: { - // "Content-Type": "application/json; charset=UTF-8" - // }, - // body: jsonEncode({ - // "email": email, - // "app_id": uid, - // }), - // ); - // if (response.statusCode == 201) { - // Navigator.of(context).pushNamedAndRemoveUntil( - // '/', - // (route) => false, - // arguments: AuthArguments( - // true, - // true, - // ), - // ); - // // signUpSuccess(); - // // setState(() { - // // successfulSignUp = true; - // // }); - // } else { - // internetConnectionPopUp(); - // } - } - - Future signUserUp() async { - context.read().reset(); - if (!validEmail()) { - MihAlertServices().invalidEmailAlert(context); - } else if (passwordController.text != confirmPasswordController.text) { - MihAlertServices().passwordMatchAlert(context); - } else { - //var _backgroundColor = Colors.transparent; - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - try { - Uri uri = Uri.parse( - "$baseAPI/auth/emailpassword/email/exists?email=${emailController.text}"); - //print("Here"); - var response = await http.get(uri); - //print(response.body); - //print("response 1: ${response.statusCode}"); - if (response.statusCode == 200) { - var userExists = jsonDecode(response.body); - if (userExists["exists"]) { - Navigator.of(context).pop(); - MihAlertServices().emailExistsAlert(context); - } else { - var response2 = await http.post( - Uri.parse("$baseAPI/auth/signup"), - body: - '{"formFields": [{"id": "email","value": "${emailController.text}"}, {"id": "password","value": "${passwordController.text}"}]}', - headers: { - 'Content-type': 'application/json', - 'Accept': 'application/json', - "Authorization": dotenv.env['SUPERTOKENS_API_KEY'] ?? "", - }, - ); - //print("response 2: ${response2.statusCode}"); - if (response2.statusCode == 200) { - //print("response 2: ${response2.body}"); - var userCreated = jsonDecode(response2.body); - //print("Created user $userCreated"); - if (userCreated["status"] == "OK") { - //print("Here1"); - //Creat user in db - String uid = await SuperTokens.getUserId(); - //print("uid: $uid"); - addUserAPICall(emailController.text, uid); - Navigator.of(context).pop(); - //print("Here1"); - } else if (userCreated["status"] == "FIELD_ERROR") { - Navigator.of(context).pop(); - MihAlertServices().passwordRequirementAlert(context); - } else { - Navigator.of(context).pop(); - MihAlertServices().internetConnectionAlert(context); - } - } - } - } - } on Exception catch (error) { - Navigator.of(context).pop(); - loginError(error.toString()); - emailController.clear(); - passwordController.clear(); - confirmPasswordController.clear(); - } - } - } - - void submitFormInput() async { - await signUserUp(); - } - - bool validEmail() { - String text = emailController.text; - var regex = RegExp(r'^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$'); - return regex.hasMatch(text); - } - - void loginError(error) { - MihAlertServices().errorAdvancedAlert( - "Sign Up Error", - "An error occurred while signing up: $error Please try again later.", - [ - MihButton( - onPressed: () { - Navigator.of(context).pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 200, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(screenWidth), - ); - } - - Widget getBody(double width) { - return KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - if (_formKey.currentState!.validate()) { - submitFormInput(); - } else { - MihAlertServices().inputErrorAlert(context); - } - } - }, - child: MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0.075), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - //logo - Icon( - Icons.lock, - size: 100, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - //spacer - const SizedBox(height: 10), - //Heading - Text( - 'Create an Account', - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - //spacer - // const SizedBox(height: 20), - MihForm( - formKey: _formKey, - formFields: [ - //email input - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: emailController, - multiLineInput: false, - requiredText: true, - hintText: "Email", - autofillHints: const [AutofillHints.email], - validator: (value) { - return MihValidationServices().validateEmail(value); - }, - ), - //spacer - const SizedBox(height: 10), - //password input - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: passwordController, - multiLineInput: false, - requiredText: true, - hintText: "Password", - passwordMode: true, - autofillHints: const [AutofillHints.password], - validator: (value) { - return MihValidationServices().validatePassword(value); - }, - ), - //spacer - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: confirmPasswordController, - multiLineInput: false, - requiredText: true, - hintText: "Confirm Password", - passwordMode: true, - autofillHints: const [AutofillHints.password], - validator: (value) { - return MihValidationServices().validatePassword(value); - }, - ), - //spacer - const SizedBox(height: 20), - // sign up button - Center( - child: Wrap( - alignment: WrapAlignment.center, - runAlignment: WrapAlignment.center, - spacing: 10, - runSpacing: 10, - children: [ - MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - submitFormInput(); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Create New Account", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - context - .read() - .setToolIndex(0); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "I have an account", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - - //here - ], - ) - ], - ), - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mih_authentication/package_tools/mih_reset_password.dart b/mih_ui/lib/mih_packages/mih_authentication/package_tools/mih_reset_password.dart deleted file mode 100644 index 72fe56e2..00000000 --- a/mih_ui/lib/mih_packages/mih_authentication/package_tools/mih_reset_password.dart +++ /dev/null @@ -1,211 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_authentication_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; - -class MihResetPassword extends StatefulWidget { - final String token; - const MihResetPassword({ - super.key, - required this.token, - }); - - @override - State createState() => _MihResetPasswordState(); -} - -class _MihResetPasswordState extends State { - final passwordController = TextEditingController(); - final confirmPasswordController = TextEditingController(); - final FocusNode _focusNode = FocusNode(); - final _formKey = GlobalKey(); - - void submitFormInput() async { - if (passwordController.text != confirmPasswordController.text) { - MihAlertServices().passwordMatchAlert(context); - } else { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - bool successfulResetPassword = await MihAuthenticationServices() - .resetPassword(widget.token, passwordController.text); - context.pop(); - if (successfulResetPassword) { - resetSuccessfully(); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - } - - void resetSuccessfully() { - MihAlertServices().successAdvancedAlert( - "Successfully Reset Password", - "Great news! Your password reset is complete. You can now log in to Mzansi Innovation Hub using your new password.", - [ - MihButton( - onPressed: () { - context.goNamed( - 'mihHome', - extra: true, - ); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(screenWidth), - ); - } - - Widget getBody(double width) { - return KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - if (_formKey.currentState!.validate()) { - submitFormInput(); - } else { - MihAlertServices().inputErrorAlert(context); - } - } - }, - child: MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0.075), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - // Text("Token: ${widget.token}"), // For testing purposes only - //logo - Icon( - Icons.lock, - size: 100, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - //spacer - const SizedBox(height: 10), - //Heading - Text( - 'Reset Password', - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - //spacer - const SizedBox(height: 25), - MihForm( - formKey: _formKey, - formFields: [ - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: passwordController, - multiLineInput: false, - requiredText: true, - hintText: "Password", - passwordMode: true, - autofillHints: const [AutofillHints.password], - validator: (value) { - return MihValidationServices().validatePassword(value); - }, - ), - //spacer - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: confirmPasswordController, - multiLineInput: false, - requiredText: true, - hintText: "Confirm Password", - passwordMode: true, - autofillHints: const [AutofillHints.password], - validator: (value) { - return MihValidationServices().validatePassword(value); - }, - ), - //spacer - const SizedBox(height: 25), - // sign in button - Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - submitFormInput(); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Reset Password", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ], - ), - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mih_authentication/package_tools/mih_sign_in.dart b/mih_ui/lib/mih_packages/mih_authentication/package_tools/mih_sign_in.dart deleted file mode 100644 index 1e64837d..00000000 --- a/mih_ui/lib/mih_packages/mih_authentication/package_tools/mih_sign_in.dart +++ /dev/null @@ -1,507 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_authentication_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_authentication_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_install_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:provider/provider.dart'; - -class MihSignIn extends StatefulWidget { - const MihSignIn({ - super.key, - }); - - @override - State createState() => _MihSignInState(); -} - -class _MihSignInState extends State { - final emailController = TextEditingController(); - final passwordController = TextEditingController(); - final FocusNode _focusNode = FocusNode(); - final _formKey = GlobalKey(); - bool successfulSignIn = false; - bool showProfiles = false; - final baseAPI = AppEnviroment.baseApiUrl; - late List sandboxProfileList = []; - - //sign user in - Future signUserIn() async { - context.read().reset(); - try { - successfulSignIn = await MihAuthenticationServices().signUserIn( - emailController.text, - passwordController.text, - context, - ); - if (!successfulSignIn) { - MihAlertServices().loginErrorAlert(context); - passwordController.clear(); - } - } on Exception { - Navigator.of(context).pop(); - MihAlertServices().internetConnectionAlert(context); - passwordController.clear(); - } - } - - void submitSignInForm() async { - await signUserIn(); - if (successfulSignIn) { - context.goNamed( - 'mihHome', - extra: true, - ); - } - } - - void setSandboxProfiles(List tileList) { - tileList.add(MihPackageTile( - onTap: () { - setState(() { - emailController.text = "testpatient@mzansi-innovation-hub.co.za"; - passwordController.text = "Testprofile@1234"; - }); - if (_formKey.currentState!.validate()) { - submitSignInForm(); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - appName: "Patient", - appIcon: Icon( - Icons.perm_identity_rounded, - color: getPrim(), - size: 200, - ), - iconSize: 200, - textColor: getPrim(), - authenticateUser: false, - )); - tileList.add(MihPackageTile( - onTap: () { - setState(() { - emailController.text = "testdoctor@mzansi-innovation-hub.co.za"; - passwordController.text = "Testprofile@1234"; - }); - if (_formKey.currentState!.validate()) { - submitSignInForm(); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - appName: "Doctor", - appIcon: Icon( - Icons.medical_services, - color: getPrim(), - size: 200, - ), - iconSize: 200, - textColor: getPrim(), - authenticateUser: false, - )); - //if (AppEnviroment.getEnv() == "Dev") { - tileList.add(MihPackageTile( - onTap: () { - setState(() { - emailController.text = "test-business@mzansi-innovation-hub.co.za"; - passwordController.text = "Testprofile@1234"; - }); - if (_formKey.currentState!.validate()) { - submitSignInForm(); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - appName: "Business", - appIcon: Icon( - Icons.business, - color: getPrim(), - size: 200, - ), - iconSize: 200, - textColor: getPrim(), - authenticateUser: false, - )); - tileList.add(MihPackageTile( - onTap: () { - setState(() { - emailController.text = "test@mzansi-innovation-hub.co.za"; - passwordController.text = "Testprofile@1234"; - }); - if (_formKey.currentState!.validate()) { - submitSignInForm(); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - appName: "Test", - appIcon: Icon( - Icons.warning_amber_rounded, - color: getPrim(), - size: 200, - ), - iconSize: 200, - textColor: getPrim(), - authenticateUser: false, - )); - //} - } - - Color getPrim() { - return MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } - - Color getSec() { - return MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } - - @override - void initState() { - super.initState(); - setState(() { - setSandboxProfiles(sandboxProfileList); - }); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(screenWidth), - ); - } - - Widget getBody(double width) { - return KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - if (_formKey.currentState!.validate()) { - submitSignInForm(); - } else { - MihAlertServices().inputErrorAlert(context); - } - } - }, - child: MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0.075), - child: AutofillGroup( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Visibility( - visible: MzansiInnovationHub.of(context)! - .theme - .getPlatform() == - "Web", - child: Padding( - padding: const EdgeInsets.all(10.0), - child: MihButton( - onPressed: () { - MihInstallServices().installMihTrigger(context); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 150, - child: Text( - "Install MIH", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ), - ], - ), - //logo - Icon( - Icons.lock, - size: 100, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - //spacer - const SizedBox(height: 10), - //Heading - Text( - 'Sign In', - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - //spacer - const SizedBox(height: 10), - MihForm( - formKey: _formKey, - formFields: [ - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: emailController, - multiLineInput: false, - requiredText: true, - hintText: "Email", - autofillHints: const [AutofillHints.email], - validator: (value) { - return MihValidationServices().validateEmail(value); - }, - ), - //spacer - const SizedBox(height: 10), - //password input - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: passwordController, - multiLineInput: false, - requiredText: true, - hintText: "Password", - passwordMode: true, - autofillHints: const [AutofillHints.password], - validator: (value) { - // return MihValidationServices().validatePassword(value); - return null; - }, - ), - const SizedBox(height: 10), - SizedBox( - // width: 500.0, - //height: 100.0, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - GestureDetector( - onTap: () { - // Navigator.of(context).pushNamed( - // '/forgot-password', - // ); - context.goNamed( - 'forgotPassword', - ); - }, - child: Text( - 'Forgot Password?', - style: TextStyle( - fontSize: 15, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - - //spacer - const SizedBox(height: 20), - // sign in button - Center( - child: Wrap( - alignment: WrapAlignment.center, - runAlignment: WrapAlignment.center, - spacing: 10, - runSpacing: 10, - children: [ - MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - submitSignInForm(); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Sign In", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - context - .read() - .setToolIndex(1); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Create New Account", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - - //spacer - const SizedBox(height: 35), - Visibility( - visible: AppEnviroment.getEnv() == "Dev", - child: Center( - child: SizedBox( - width: width, - //height: 100.0, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Flexible( - flex: 1, - child: Padding( - padding: EdgeInsets.only(right: 10.0), - child: Divider(), - ), - ), - Flexible( - flex: 1, - child: GestureDetector( - child: Text( - 'Use Sandox Profile', - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 15, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark")), - ), - onTap: () { - setState(() { - showProfiles = !showProfiles; - }); - }, - ), - ), - const Flexible( - flex: 1, - child: Padding( - padding: EdgeInsets.only(left: 10.0), - child: Divider(), - ), - ), - ], - ), - ), - ), - ), - const SizedBox(height: 10), - Center( - child: Visibility( - visible: showProfiles, - child: SizedBox( - width: 500, - child: Column( - //mainAxisSize: MainAxisSize.max, - children: [ - GridView.builder( - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: sandboxProfileList.length, - gridDelegate: - const SliverGridDelegateWithMaxCrossAxisExtent( - mainAxisSpacing: 10, - maxCrossAxisExtent: 100), - itemBuilder: (context, index) { - return sandboxProfileList[index]; - }, - ), - // const SizedBox(height: 10), - Text( - "NB: These accounts are used for test purposes. Please do not store personal information on these profiles.", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - ), - ), - ], - ), - ], - ), - ), - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mih_file_viewer/components/mih_print_prevew.dart b/mih_ui/lib/mih_packages/mih_file_viewer/components/mih_print_prevew.dart deleted file mode 100644 index 4b241eae..00000000 --- a/mih_ui/lib/mih_packages/mih_file_viewer/components/mih_print_prevew.dart +++ /dev/null @@ -1,52 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_objects/arguments.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:pdf/pdf.dart'; -import 'package:printing/printing.dart'; -import '../../../mih_package_components/mih_loading_circle.dart'; - -class MIHPrintPreview extends StatefulWidget { - final PrintPreviewArguments arguments; - const MIHPrintPreview({ - super.key, - required this.arguments, - }); - - @override - State createState() => _MIHPrintPreviewState(); -} - -class _MIHPrintPreviewState extends State { - MihPackageAction getActionButton() { - return MihPackageAction( - icon: const Icon( - Icons.close, - ), - iconSize: 35, - onTap: () { - Navigator.pop(context); - }, - ); - } - - @override - void dispose() { - super.dispose(); - } - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return PdfPreview( - pdfFileName: widget.arguments.fileName, - initialPageFormat: PdfPageFormat.a4, - loadingWidget: const Mihloadingcircle(), - actions: [getActionButton()], - build: (format) => widget.arguments.pdfData, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mih_file_viewer/mih_fle_viewer.dart b/mih_ui/lib/mih_packages/mih_file_viewer/mih_fle_viewer.dart deleted file mode 100644 index 5432ca7a..00000000 --- a/mih_ui/lib/mih_packages/mih_file_viewer/mih_fle_viewer.dart +++ /dev/null @@ -1,72 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_file_viewer_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mih_file_viewer/package_tools/mih_expanded_file_view.dart'; -import 'package:provider/provider.dart'; - -class MihFleViewer extends StatefulWidget { - const MihFleViewer({super.key}); - - @override - State createState() => _MihFleViewerState(); -} - -class _MihFleViewerState extends State { - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, MihFileViewerProvider fileViewerProvider, - Widget? child) { - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: getToolTitle(), - selectedbodyIndex: fileViewerProvider.toolIndex, - onIndexChange: (newIndex) { - fileViewerProvider.setToolIndex(newIndex); - }, - ); - }, - ); - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.fullscreen_exit), - iconSize: 35, - onTap: () { - context.pop(); - FocusScope.of(context).unfocus(); - }, - ); - } - - List getToolTitle() { - List toolTitles = [ - "File Viewer", - ]; - return toolTitles; - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.file_present)] = () { - context.read().setToolIndex(0); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: context.watch().toolIndex, - ); - } - - List getToolBody() { - List toolBodies = [ - MihExpandedFileView(), - ]; - return toolBodies; - } -} diff --git a/mih_ui/lib/mih_packages/mih_file_viewer/package_tools/mih_expanded_file_view.dart b/mih_ui/lib/mih_packages/mih_file_viewer/package_tools/mih_expanded_file_view.dart deleted file mode 100644 index d1fcdb70..00000000 --- a/mih_ui/lib/mih_packages/mih_file_viewer/package_tools/mih_expanded_file_view.dart +++ /dev/null @@ -1,271 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_file_viewer_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:provider/provider.dart'; -import 'package:syncfusion_flutter_core/theme.dart'; -import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart'; -import "package:universal_html/html.dart" as html; -import 'package:fl_downloader/fl_downloader.dart'; - -class MihExpandedFileView extends StatefulWidget { - const MihExpandedFileView({super.key}); - - @override - State createState() => _MihExpandedFileViewState(); -} - -class _MihExpandedFileViewState extends State { - late PdfViewerController pdfViewerController = PdfViewerController(); - int currentPageCount = 0; - int currentPage = 0; - double startZoomLevel = 1.0; - double zoomOut = 0; - int progress = 0; - late StreamSubscription progressStream; - - void nativeFileDownload(String fileLink) async { - var permission = await FlDownloader.requestPermission(); - if (permission == StoragePermissionStatus.granted) { - try { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - await FlDownloader.download(fileLink); - Navigator.of(context).pop(); - } on Exception catch (error) { - Navigator.of(context).pop(); - print(error); - } - } else { - print("denied"); - } - } - - @override - Widget build(BuildContext context) { - final Size size = MediaQuery.sizeOf(context); - double width = size.width; - double height = size.height; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(width, height), - ); - } - - Widget getBody(double width, double height) { - return Consumer( - builder: (BuildContext context, MihFileViewerProvider fileViewerProvider, - Widget? child) { - bool isPDF = - fileViewerProvider.filePath.split(".").last.toLowerCase() == "pdf"; - return Stack( - children: [ - fileViewerProvider.filePath.split(".").last.toLowerCase() == "pdf" - ? SizedBox( - width: width - zoomOut, - height: height - 70, - child: SfPdfViewerTheme( - data: SfPdfViewerThemeData( - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - child: SfPdfViewer.network( - fileViewerProvider.fileLink, - controller: pdfViewerController, - initialZoomLevel: startZoomLevel, - pageSpacing: 2, - maxZoomLevel: 5, - interactionMode: PdfInteractionMode.pan, - onDocumentLoaded: (details) { - setState(() { - currentPage = pdfViewerController.pageNumber; - currentPageCount = pdfViewerController.pageCount; - }); - }, - ), - ), - ) - : SizedBox( - width: width, - height: height - 70, - child: InteractiveViewer( - maxScale: 5.0, - //minScale: 0., - child: Image.network(fileViewerProvider.fileLink), - ), - ), - Padding( - padding: const EdgeInsets.only(bottom: 20.0), - child: Align( - alignment: Alignment.bottomCenter, - child: Material( - elevation: 10, - shadowColor: Colors.black, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(25.0), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - if (isPDF) - IconButton( - iconSize: 30, - padding: const EdgeInsets.all(0), - onPressed: () { - pdfViewerController.previousPage(); - //print(pdfViewerController.); - //if (pdfViewerController.pageNumber > 1) { - setState(() { - currentPage = pdfViewerController.pageNumber; - }); - // } - }, - icon: Icon( - Icons.arrow_back, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - if (isPDF) - Text( - "$currentPage / $currentPageCount", - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - if (isPDF) - IconButton( - iconSize: 30, - padding: const EdgeInsets.all(0), - onPressed: () { - pdfViewerController.nextPage(); - //print(pdfViewerController.pageNumber); - //if (pdfViewerController.pageNumber < currentPageCount) { - setState(() { - currentPage = pdfViewerController.pageNumber; - }); - //} - }, - icon: Icon( - Icons.arrow_forward, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - if (isPDF) - IconButton( - iconSize: 30, - padding: const EdgeInsets.all(0), - onPressed: () { - if (zoomOut > 0) { - setState(() { - zoomOut = zoomOut - 100; - }); - } else { - setState(() { - pdfViewerController.zoomLevel = - startZoomLevel + 0.25; - startZoomLevel = - pdfViewerController.zoomLevel; - }); - } - }, - icon: Icon( - Icons.zoom_in, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - if (isPDF) - IconButton( - iconSize: 30, - padding: const EdgeInsets.all(0), - onPressed: () { - if (pdfViewerController.zoomLevel > 1) { - setState(() { - pdfViewerController.zoomLevel = - startZoomLevel - 0.25; - startZoomLevel = - pdfViewerController.zoomLevel; - }); - } else { - if (zoomOut < (width - 100)) { - setState(() { - zoomOut = zoomOut + 100; - }); - } - } - }, - icon: Icon( - Icons.zoom_out, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - // IconButton( - // iconSize: 30, - // padding: const EdgeInsets.all(0), - // onPressed: () { - // printDocument(); - // }, - // icon: Icon( - // Icons.print, - // color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - // ), - IconButton( - iconSize: 30, - padding: const EdgeInsets.all(0), - onPressed: () { - if (kIsWeb) { - html.window.open( - fileViewerProvider.fileLink, 'download'); - } else { - nativeFileDownload( - fileViewerProvider.fileLink, - ); - } - }, - icon: Icon( - Icons.download, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ], - ), - ), - ), - ), - ), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mih_home/components/mih_app_drawer.dart b/mih_ui/lib/mih_packages/mih_home/components/mih_app_drawer.dart deleted file mode 100644 index 71ec53f7..00000000 --- a/mih_ui/lib/mih_packages/mih_home/components/mih_app_drawer.dart +++ /dev/null @@ -1,434 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_providers/about_mih_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_access_controlls_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_authentication_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_banner_ad_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_calculator_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_mine_sweeper_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_ai_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_wallet_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:provider/provider.dart'; -import '../../../main.dart'; -import 'package:supertokens_flutter/supertokens.dart'; - -class MIHAppDrawer extends StatefulWidget { - const MIHAppDrawer({ - super.key, - }); - - @override - State createState() => _MIHAppDrawerState(); -} - -class _MIHAppDrawerState extends State { - final proPicController = TextEditingController(); - late Widget profilePictureLoaded; - - void resetProviders() { - context.read().reset(); - context.read().reset(); - context.read().reset(); - context.read().reset(); - context.read().reset(); - context.read().reset(); - context.read().reset(); - context.read().reset(); - context.read().reset(); - context.read().reset(); - context.read().reset(); - } - - Future signOut() async { - await SuperTokens.signOut(completionHandler: (error) { - // handle error if any - }); - return true; - } - - Widget displayProPic(MzansiProfileProvider mzansiProfileProvider) { - return GestureDetector( - onTap: () { - if (mzansiProfileProvider.personalHome) { - context.goNamed( - 'mzansiProfileManage', - ); - } else { - if (mzansiProfileProvider.business == null) { - context.goNamed( - 'businessProfileSetup', - extra: mzansiProfileProvider.user, - ); - } else { - context.goNamed( - "businessProfileManage", - ); - } - } - }, - child: MihCircleAvatar( - imageFile: mzansiProfileProvider.personalHome - ? mzansiProfileProvider.userProfilePicture - : mzansiProfileProvider.businessProfilePicture, - width: 60, - expandable: false, - editable: false, - fileNameController: proPicController, - onChange: (_) {}, - userSelectedfile: null, - frameColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - backgroundColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ); - } - - @override - void dispose() { - proPicController.dispose(); - super.dispose(); - } - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - // precacheImage( - // MzansiInnovationHub.of(context)!.theme.logoImage().image, context); - return Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - return SafeArea( - child: Drawer( - //backgroundColor: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: LayoutBuilder( - builder: (BuildContext context, BoxConstraints constraints) { - return Stack( - //fit: StackFit.passthrough, - children: [ - Column( - // reverse: false, - // padding: EdgeInsets.zero, - mainAxisSize: MainAxisSize.max, - children: [ - DrawerHeader( - decoration: BoxDecoration( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - child: SizedBox( - // height: 300, - width: constraints.maxWidth, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - displayProPic(mzansiProfileProvider), - Visibility( - visible: !mzansiProfileProvider.personalHome, - child: Text( - mzansiProfileProvider.business?.Name ?? - "Setup Business", - style: TextStyle( - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - ), - Visibility( - visible: mzansiProfileProvider.personalHome, - child: Text( - "${mzansiProfileProvider.user!.fname} ${mzansiProfileProvider.user!.lname}", - style: TextStyle( - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - ), - Visibility( - visible: !mzansiProfileProvider.personalHome, - child: Text( - mzansiProfileProvider.business?.type ?? "", - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - ), - Visibility( - visible: mzansiProfileProvider.personalHome, - child: Text( - "@${mzansiProfileProvider.user!.username}", - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - ), - Text( - mzansiProfileProvider.user!.type - .toUpperCase(), - style: TextStyle( - fontSize: 10, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - ], - ), - ), - ), - // ListTile( - // title: Row( - // mainAxisSize: MainAxisSize.max, - // children: [ - // Icon( - // Icons.home_outlined, - // color: - // MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - // const SizedBox(width: 25.0), - // Text( - // "Home", - // style: TextStyle( - // //fontWeight: FontWeight.bold, - // color: MzansiInnovationHub.of(context)! - // .theme - // .secondaryColor(), - // ), - // ), - // ], - // ), - // onTap: () { - // Navigator.of(context) - // .pushNamedAndRemoveUntil('/', (route) => false); - // }, - // ), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - mainAxisSize: MainAxisSize.max, - children: [ - ListTile( - title: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Icon( - Icons.policy, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - const SizedBox(width: 25.0), - Text( - "Privacy Policy", - style: TextStyle( - //fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - ], - ), - onTap: () { - WidgetsBinding.instance - .addPostFrameCallback((_) async { - context - .read() - .setToolIndex(1); - }); - context.goNamed( - "aboutMih", - extra: true, - ); - }, - ), - ListTile( - title: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Icon( - Icons.design_services_rounded, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - const SizedBox(width: 25.0), - Text( - "Terms of Service", - style: TextStyle( - //fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - ], - ), - onTap: () { - WidgetsBinding.instance - .addPostFrameCallback((_) async { - context - .read() - .setToolIndex(2); - }); - context.goNamed( - "aboutMih", - extra: true, - ); - }, - ), - ListTile( - title: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Icon( - Icons.logout, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - const SizedBox(width: 25.0), - Text( - "Sign Out", - style: TextStyle( - //fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - ], - ), - onTap: () async { - await SuperTokens.signOut( - completionHandler: (error) { - print(error); - }); - if (await SuperTokens.doesSessionExist() == - false) { - resetProviders(); - await Future.delayed(Duration.zero); - if (context.mounted) { - context.goNamed( - 'mihHome', - ); - } - } - }, - ), - ], - ), - ), - ], - ), - Positioned( - top: 5, - right: 5, - width: 30, - height: 30, - child: InkWell( - onTap: () { - // setState(() { - // if (MzansiInnovationHub.of(context)?.theme.mode == - // "Dark") { - // //darkm = !darkm; - // MzansiInnovationHub.of(context)! - // .changeTheme(ThemeMode.light); - // //print("Dark Mode: $darkm"); - // } else { - // //darkm = !darkm; - // MzansiInnovationHub.of(context)! - // .changeTheme(ThemeMode.dark); - // //print("Dark Mode: $darkm"); - // } - // // Navigator.of(context).popAndPushNamed('/',); - // }); - context.goNamed("aboutMih"); - }, - child: Icon( - MihIcons.mihLogo, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - // IconButton( - // onPressed: () { - // setState(() { - // if (MzansiInnovationHub.of(context)?.theme.mode == "Dark") { - // //darkm = !darkm; - // MzansiInnovationHub.of(context)!.changeTheme(ThemeMode.light); - // //print("Dark Mode: $darkm"); - // } else { - // //darkm = !darkm; - // MzansiInnovationHub.of(context)!.changeTheme(ThemeMode.dark); - // //print("Dark Mode: $darkm"); - // } - // Navigator.of(context).popAndPushNamed('/'); - // }); - // }, - // icon: Icon( - // Icons.light_mode, - // color: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // size: 35, - // ), - // ), - ), - ], - ); - }, - ), - ), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mih_home/mih_home.dart b/mih_ui/lib/mih_packages/mih_home/mih_home.dart deleted file mode 100644 index aaa59ed2..00000000 --- a/mih_ui/lib/mih_packages/mih_home/mih_home.dart +++ /dev/null @@ -1,414 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/user_consent.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_scack_bar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/about_mih_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mih_home/components/mih_app_drawer.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mih_home/package_tools/mih_business_home.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mih_home/package_tools/mih_personal_home.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_data_helper_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_user_consent_services.dart'; -import 'package:provider/provider.dart'; - -class MihHome extends StatefulWidget { - const MihHome({ - super.key, - }); - - @override - State createState() => _MihHomeState(); -} - -class _MihHomeState extends State { - DateTime latestPrivacyPolicyDate = DateTime.parse("2024-12-01"); - DateTime latestTermOfServiceDate = DateTime.parse("2024-12-01"); - bool _isLoadingInitialData = true; - late final MihPersonalHome _personalHome; - late final MihBusinessHome? _businessHome; - - Future _loadInitialData() async { - setState(() { - _isLoadingInitialData = true; - }); - MzansiProfileProvider mzansiProfileProvider = - context.read(); - - if (mzansiProfileProvider.user == null) { - await MihDataHelperServices().loadUserDataWithBusinessesData( - mzansiProfileProvider, - ); - } - _personalHome = const MihPersonalHome(); - _businessHome = mzansiProfileProvider.business != null - ? MihBusinessHome(isLoading: _isLoadingInitialData) - : null; - if (mounted) { - setState(() { - _isLoadingInitialData = false; - }); - } - } - - bool showPolicyWindow(UserConsent? userConsent) { - if (userConsent == null) { - return true; - } else { - if (userConsent.privacy_policy_accepted - .isAfter(latestPrivacyPolicyDate) && - userConsent.terms_of_services_accepted - .isAfter(latestTermOfServiceDate)) { - return false; - } else { - return true; - } - } - } - - void createOrUpdateAccpetance(MzansiProfileProvider mzansiProfileProvider) { - UserConsent? userConsent = mzansiProfileProvider.userConsent; - userConsent != null - ? MihUserConsentServices() - .updateUserConsentStatus( - DateTime.now().toIso8601String(), - DateTime.now().toIso8601String(), - mzansiProfileProvider, - context, - ) - .then((value) { - if (!mounted) return; - if (value == 200) { - context.goNamed("mihHome"); - ScaffoldMessenger.of(context).showSnackBar( - MihSnackBar( - child: Text("Thank you for accepting our Policies"), - ), - ); - } else { - ScaffoldMessenger.of(context).showSnackBar( - MihSnackBar( - child: Text("There was an error, please try again later"), - ), - ); - } - }) - : MihUserConsentServices() - .insertUserConsentStatus( - DateTime.now().toIso8601String(), - DateTime.now().toIso8601String(), - mzansiProfileProvider, - context, - ) - .then((value) { - if (value == 201) { - context.goNamed("mihHome"); - ScaffoldMessenger.of(context).showSnackBar( - MihSnackBar( - child: Text("Thank you for accepting our Policies"), - ), - ); - } else { - ScaffoldMessenger.of(context).showSnackBar( - MihSnackBar( - child: Text("There was an error, please try again later"), - ), - ); - } - }); - } - - Widget displayConsentWindow(MzansiProfileProvider mzansiProfileProvider) { - return Container( - color: Colors.black.withValues(alpha: 0.5), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - windowBody: Column( - children: [ - Icon( - Icons.policy, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark", - ), - ), - const SizedBox(height: 10), - Text( - "Welcome to the MIH App", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark", - ), - fontSize: 30, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 10), - Text( - "To keep using the MIH app, please take a moment to review and accept our Policies. Our agreements helps us keep things running smoothly and securely.", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark", - ), - fontSize: 18, - fontWeight: FontWeight.normal, - ), - ), - const SizedBox(height: 20), - Center( - child: Wrap( - runAlignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - alignment: WrapAlignment.center, - spacing: 10, - runSpacing: 10, - children: [ - MihButton( - onPressed: () { - WidgetsBinding.instance - .addPostFrameCallback((_) async { - context.read().setToolIndex(1); - }); - context.goNamed("aboutMih", - extra: mzansiProfileProvider.personalHome); - }, - buttonColor: MihColors.getOrangeColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - elevation: 10, - width: 300, - child: Text( - "Privacy Policy", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - WidgetsBinding.instance - .addPostFrameCallback((_) async { - context.read().setToolIndex(2); - }); - context.goNamed("aboutMih", - extra: mzansiProfileProvider.personalHome); - }, - buttonColor: MihColors.getYellowColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - elevation: 10, - width: 300, - child: Text( - "Terms of Service", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - DateTime now = DateTime.now(); - KenLogger.success("Date Time Now: $now"); - createOrUpdateAccpetance(mzansiProfileProvider); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - elevation: 10, - width: 300, - child: Text( - "Accept", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - const SizedBox(height: 10), - ], - ), - ), - ], - ), - ); - } - - @override - void dispose() { - super.dispose(); - } - - @override - void initState() { - super.initState(); - _loadInitialData(); - } - - List getToolTitle() { - List toolTitles = [ - "Personal", - "Business", - ]; - return toolTitles; - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - if (_isLoadingInitialData) { - return Scaffold( - body: Center( - child: Mihloadingcircle(), - ), - ); - } - // bool showConsentWindow = - // showPolicyWindow(mzansiProfileProvider.userConsent); - return Stack( - children: [ - RefreshIndicator( - onRefresh: () async { - await _loadInitialData(); - }, - child: SingleChildScrollView( - physics: const AlwaysScrollableScrollPhysics(), - child: SizedBox( - height: MediaQuery.of(context).size.height, - child: MihPackage( - appActionButton: getAction(), - appTools: getTools(mzansiProfileProvider, - mzansiProfileProvider.user!.type != "personal"), - appBody: getToolBody(mzansiProfileProvider), - appToolTitles: getToolTitle(), - actionDrawer: getActionDrawer(), - selectedbodyIndex: - mzansiProfileProvider.personalHome ? 0 : 1, - onIndexChange: (newValue) { - mzansiProfileProvider.setPersonalHome(newValue == 0); - }, - ), - ), - ), - ), - if (showPolicyWindow(mzansiProfileProvider.userConsent)) - displayConsentWindow(mzansiProfileProvider), - ], - ); - }, - ); - } - - Widget getAction() { - return Builder(builder: (context) { - return Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - ImageProvider? currentImage; - String imageKey; - if (mzansiProfileProvider.personalHome) { - currentImage = mzansiProfileProvider.userProfilePicture; - imageKey = 'user_${mzansiProfileProvider.userProfilePicUrl}'; - } else { - currentImage = mzansiProfileProvider.businessProfilePicture; - imageKey = - 'business_${mzansiProfileProvider.businessProfilePicUrl}'; - } - return MihPackageAction( - icon: Padding( - padding: const EdgeInsets.only(left: 5.0), - child: MihCircleAvatar( - key: Key(imageKey), - imageFile: currentImage, - width: 50, - expandable: false, - editable: false, - fileNameController: null, - userSelectedfile: null, - // frameColor: frameColor, - frameColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onChange: (_) {}, - ), - ), - iconSize: 45, - onTap: () { - Scaffold.of(context).openDrawer(); - FocusScope.of(context) - .requestFocus(FocusNode()); // Fully unfocus all fields - // FocusScope.of(context).unfocus(); // Unfocus any text fields - }, - ); - }, - ); - }); - } - - MIHAppDrawer getActionDrawer() { - return MIHAppDrawer(); - } - - MihPackageTools getTools( - MzansiProfileProvider mzansiProfileProvider, bool isBusinessUser) { - Map temp = {}; - temp[const Icon(Icons.person)] = () { - mzansiProfileProvider.setPersonalHome(true); - }; - if (isBusinessUser) { - temp[const Icon(Icons.business_center)] = () { - mzansiProfileProvider.setPersonalHome(false); - }; - } - return MihPackageTools( - tools: temp, - selcetedIndex: mzansiProfileProvider.personalHome ? 0 : 1, - ); - } - - List getToolBody(MzansiProfileProvider mzansiProfileProvider) { - if (mzansiProfileProvider.business == null) { - return [ - _personalHome, - ]; - } else { - return [ - _personalHome, - _businessHome!, - ]; - } - } -} diff --git a/mih_ui/lib/mih_packages/mih_home/mih_home_error.dart b/mih_ui/lib/mih_packages/mih_home/mih_home_error.dart deleted file mode 100644 index 05f05368..00000000 --- a/mih_ui/lib/mih_packages/mih_home/mih_home_error.dart +++ /dev/null @@ -1,151 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihHomeError extends StatefulWidget { - final String errorMessage; - const MihHomeError({ - super.key, - required this.errorMessage, - }); - - @override - State createState() => _MihHomeErrorState(); -} - -class _MihHomeErrorState extends State { - int _selcetedIndex = 0; - - @override - Widget build(BuildContext context) { - return MihPackage( - appActionButton: getErrorAction(), - appTools: getErrorTools(), - appToolTitles: ["Connection Error"], - appBody: getErrorToolBody(widget.errorMessage), - selectedbodyIndex: _selcetedIndex, - onIndexChange: (newValue) { - setState(() { - _selcetedIndex = newValue; - }); - //print("Index: $_selcetedIndex"); - }, - ); - } - - MihPackageAction getErrorAction() { - return MihPackageAction( - icon: const Icon(Icons.refresh), - iconSize: 35, - onTap: () { - context.goNamed( - 'mihHome', - extra: true, - ); - }, - ); - } - - MihPackageTools getErrorTools() { - Map temp = {}; - temp[const Icon(Icons.power_off_outlined)] = () { - setState(() { - _selcetedIndex = 0; - }); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: _selcetedIndex, - ); - } - - List getErrorToolBody(String error) { - List toolBodies = [ - MihPackageToolBody( - borderOn: true, - bodyItem: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - "Connection Error", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 35, - fontWeight: FontWeight.bold, - ), - ), - Icon( - Icons.power_off_outlined, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - SizedBox( - width: 500, - child: Text( - "Looks like we ran into an issue getting your data.\nPlease check you internet connection and try again.", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - MihButton( - onPressed: () { - context.goNamed( - 'mihHome', - extra: true, - ); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Refresh", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Padding( - padding: const EdgeInsets.all(10.0), - child: SizedBox( - width: 500, - child: SelectionArea( - child: Text( - "Error: $error", - textAlign: TextAlign.left, - style: TextStyle( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 15, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ), - ], - ), - ) - ]; - return toolBodies; - } -} diff --git a/mih_ui/lib/mih_packages/mih_home/mih_route_error.dart b/mih_ui/lib/mih_packages/mih_home/mih_route_error.dart deleted file mode 100644 index 51a541c6..00000000 --- a/mih_ui/lib/mih_packages/mih_home/mih_route_error.dart +++ /dev/null @@ -1,150 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihRouteError extends StatefulWidget { - const MihRouteError({ - super.key, - }); - - @override - State createState() => _MihRouteErrorState(); -} - -class _MihRouteErrorState extends State { - int _selcetedIndex = 0; - - @override - Widget build(BuildContext context) { - return MihPackage( - appActionButton: getErrorAction(), - appTools: getErrorTools(), - appToolTitles: ["Invalid Path"], - appBody: getErrorToolBody(), - selectedbodyIndex: _selcetedIndex, - onIndexChange: (newValue) { - setState(() { - _selcetedIndex = newValue; - }); - //print("Index: $_selcetedIndex"); - }, - ); - } - - MihPackageAction getErrorAction() { - return MihPackageAction( - icon: const Icon(MihIcons.mihLogo), - iconSize: 35, - onTap: () { - context.goNamed( - 'mihHome', - extra: true, - ); - }, - ); - } - - MihPackageTools getErrorTools() { - Map temp = {}; - temp[const Icon(Icons.link_off_rounded)] = () { - setState(() { - _selcetedIndex = 0; - }); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: _selcetedIndex, - ); - } - - List getErrorToolBody() { - List toolBodies = [ - MihPackageToolBody( - borderOn: true, - bodyItem: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - "Oops! Wrong Turn.", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 35, - fontWeight: FontWeight.bold, - ), - ), - Icon( - Icons.link_off_rounded, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - SizedBox( - width: 700, - child: Text( - "It looks like you've taken a wrong turn and ended up on a package that doesn't exist within the MIH App.\n\nDon't worry, getting back is easy. Just click the button below or the MIH Logo to return to the correct path.", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - const SizedBox(height: 15), - MihButton( - onPressed: () { - context.goNamed( - 'mihHome', - extra: true, - ); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Back to MIH", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - // const SizedBox(height: 15), - // Padding( - // padding: const EdgeInsets.all(10.0), - // child: SizedBox( - // width: 500, - // child: SelectionArea( - // child: Text( - // "Error: $error", - // textAlign: TextAlign.left, - // style: TextStyle( - // color: MihColors.getRedColor( - // MzansiInnovationHub.of(context)!.theme.mode == - // "Dark"), - // fontSize: 15, - // fontWeight: FontWeight.bold, - // ), - // ), - // ), - // ), - // ), - ], - ), - ) - ]; - return toolBodies; - } -} diff --git a/mih_ui/lib/mih_packages/mih_home/package_tools/mih_business_home.dart b/mih_ui/lib/mih_packages/mih_home/package_tools/mih_business_home.dart deleted file mode 100644 index d0155b07..00000000 --- a/mih_ui/lib/mih_packages/mih_home/package_tools/mih_business_home.dart +++ /dev/null @@ -1,293 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart'; -import 'package:mzansi_innovation_hub/mih_objects/arguments.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_ai_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/about_mih/package_tile/about_mih_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/calculator/package_tiles/mih_calculator_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/calendar/package_tiles/mzansi_calendar_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_ai/package_tiles/mzansi_ai_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/package_tiles/mzansi_directory_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tiles/mzansi_business_profile_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tiles/mzansi_setup_business_profile_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_manager/package_tiles/pat_manager_tile.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class MihBusinessHome extends StatefulWidget { - final bool isLoading; - const MihBusinessHome({ - super.key, - required this.isLoading, - }); - - @override - State createState() => _MihBusinessHomeState(); -} - -class _MihBusinessHomeState extends State - with SingleTickerProviderStateMixin { - final TextEditingController searchController = TextEditingController(); - late List> businessPackagesMap; - final ValueNotifier>> searchPackageName = - ValueNotifier([]); - double packageSize = 200; - // late final AnimationController _marqueeController; - // late final ScrollController _scrollController; - final FocusNode _searchFocusNode = FocusNode(); - final String maintenanceMsg = - "\tHeads up! We're doing maintenance on Thur, 15 May 2025 at 10 PM (CAT). MIH may be unavailable briefly."; - - // void _startMarquee() async { - // while (mounted) { - // final double maxScroll = _scrollController.position.maxScrollExtent; - // await Future.delayed(const Duration(milliseconds: 500)); - // await _scrollController.animateTo( - // maxScroll, - // duration: _marqueeController.duration!, - // curve: Curves.linear, - // ); - // await Future.delayed(const Duration(milliseconds: 500)); - // _scrollController.jumpTo(0); - // await Future.delayed(const Duration(milliseconds: 500)); - // } - // } - - List> setNewBusinessUserPackages() { - List> temp = []; - temp.add({ - "Setup Business": MzansiSetupBusinessProfileTile( - packageSize: packageSize, - ) - }); - return temp; - } - - List> setBusinessPackages() { - MzansiProfileProvider mzansiProfileProvider = - context.read(); - // if (mzansiProfileProvider.user == null || - // mzansiProfileProvider.business == null || - // mzansiProfileProvider.businessUser == null) { - // return []; // Return empty list if data isn't ready - // } - List> temp = []; - if (mzansiProfileProvider.business == null && !widget.isLoading) { - temp.add({ - "Setup Business": MzansiSetupBusinessProfileTile( - packageSize: packageSize, - ) - }); - return temp; - } - //=============== Biz Profile =============== - temp.add({ - "Business Profile": MzansiBusinessProfileTile( - packageSize: packageSize, - ) - }); - //=============== Pat Manager =============== - temp.add({ - "Patient Manager": PatManagerTile( - arguments: PatManagerArguments( - mzansiProfileProvider.user!, - false, - mzansiProfileProvider.business!, - mzansiProfileProvider.businessUser!, - ), - packageSize: packageSize, - ) - }); - //=============== Calendar =============== - temp.add({ - "Calendar": MzansiCalendarTile( - packageSize: packageSize, - ) - }); - //=============== Mzansi Directory =============== - temp.add({ - "Mzansi Directory": MzansiDirectoryTile( - packageSize: packageSize, - ) - }); - //=============== Calculator =============== - temp.add({ - "Calculator": MihCalculatorTile( - packageSize: packageSize, - ) - }); - //=============== Mzansi AI =============== - temp.add({ - "Mzansi AI": MzansiAiTile( - packageSize: packageSize, - ) - }); - //=============== About MIH =============== - temp.add({ - "About MIH": AboutMihTile( - packageSize: packageSize, - ) - }); - return temp; - } - - EdgeInsets getPadding(double width, double height) { - if (MzansiInnovationHub.of(context)!.theme.screenType == "mobile") { - double mobilePadding = 10; - return EdgeInsets.only( - left: mobilePadding, - right: mobilePadding, - bottom: mobilePadding, - ); - } else { - return EdgeInsets.only( - left: width / 13, - right: width / 13, - bottom: height / 15, - ); - } - } - - void searchPackage() { - if (searchController.text.isEmpty) { - searchPackageName.value = businessPackagesMap; - } else { - List> temp = []; - for (var item in businessPackagesMap) { - if (item.keys.first.toLowerCase().contains(searchController.text)) { - temp.add(item); - } - } - searchPackageName.value = temp; - } - } - - @override - void dispose() { - super.dispose(); - searchController.removeListener(searchPackage); - searchController.dispose(); - // _marqueeController.dispose(); - // _scrollController.dispose(); - _searchFocusNode.dispose(); - } - - @override - void initState() { - super.initState(); - searchController.addListener(searchPackage); - - businessPackagesMap = setBusinessPackages(); - searchPackage(); - } - - @override - Widget build(BuildContext context) { - final Size size = MediaQuery.sizeOf(context); - final double width = size.width; - final double height = size.height; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(width, height), - ); - } - - Widget getBody(double width, double height) { - return Consumer2( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, - MzansiAiProvider mzansiAiProvider, - Widget? child) { - return Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: Visibility( - visible: mzansiProfileProvider.business != null, - child: MihSearchBar( - controller: searchController, - hintText: "Ask Mzansi", - prefixIcon: Icons.search, - prefixAltIcon: MihIcons.mzansiAi, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - hintColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onPrefixIconTap: () { - mzansiAiProvider.ollamaProvider.resetChat(); - if (searchController.text.isNotEmpty) { - mzansiAiProvider - .setStartUpQuestion(searchController.text); - } - context.goNamed("mzansiAi"); - searchController.clear(); - }, - searchFocusNode: _searchFocusNode, - ), - ), - ), - const SizedBox(height: 10), - Expanded( - child: ValueListenableBuilder( - valueListenable: searchPackageName, - builder: (context, value, child) { - List filteredPackages = value - .where((package) => package.keys.first - .toLowerCase() - .contains(searchController.text.toLowerCase())) - .map((package) => package.values.first) - .toList(); - if (filteredPackages.isNotEmpty) { - return GridView.builder( - padding: getPadding(width, height), - itemCount: filteredPackages.length, - gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( - maxCrossAxisExtent: packageSize, - crossAxisSpacing: 5, - ), - itemBuilder: (context, index) { - return filteredPackages[index]; - }, - ); - } else { - return Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.mzansiAi, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - const SizedBox(height: 10), - Text( - "Mzansi AI is here to help you!", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ], - ); - } - }, - ), - ), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mih_home/package_tools/mih_personal_home.dart b/mih_ui/lib/mih_packages/mih_home/package_tools/mih_personal_home.dart deleted file mode 100644 index b1e74f8a..00000000 --- a/mih_ui/lib/mih_packages/mih_home/package_tools/mih_personal_home.dart +++ /dev/null @@ -1,313 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tiles/test_package_tile.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_ai_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/about_mih/package_tile/about_mih_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/access_review/package_tile/mih_access_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/calculator/package_tiles/mih_calculator_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/calendar/package_tiles/mzansi_calendar_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/package_tiles/mih_mine_sweeper_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_ai/package_tiles/mzansi_ai_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/package_tiles/mzansi_directory_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/personal_profile/package_tiles/mzansi_profile_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/personal_profile/package_tiles/mzansi_setup_profile_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/package_tiles/mih_wallet_tile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/package_tiles/patient_profile_tile.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:provider/provider.dart'; - -class MihPersonalHome extends StatefulWidget { - const MihPersonalHome({ - super.key, - }); - - @override - State createState() => _MihPersonalHomeState(); -} - -class _MihPersonalHomeState extends State - with SingleTickerProviderStateMixin { - final TextEditingController searchController = TextEditingController(); - late List> personalPackagesMap; - final ValueNotifier>> searchPackageName = - ValueNotifier([]); - double packageSize = 200; - // late final AnimationController _marqueeController; - // late final ScrollController _scrollController; - final FocusNode _searchFocusNode = FocusNode(); - final String maintenanceMsg = - "\tHeads up! We're doing maintenance on Thur, 15 May 2025 at 10 PM (CAT). MIH may be unavailable briefly."; - - // void _startMarquee() async { - // while (mounted) { - // final double maxScroll = _scrollController.position.maxScrollExtent; - // await Future.delayed(const Duration(milliseconds: 500)); - // await _scrollController.animateTo( - // maxScroll, - // duration: _marqueeController.duration!, - // curve: Curves.linear, - // ); - // await Future.delayed(const Duration(milliseconds: 500)); - // _scrollController.jumpTo(0); - // await Future.delayed(const Duration(milliseconds: 500)); - // } - // } - - List> setNerUserPersonalPackage() { - List> temp = []; - temp.add({ - "Setup Profile": MzansiSetupProfileTile( - packageSize: packageSize, - ) - }); - return temp; - } - - List> setPersonalPackagesMap() { - List> temp = []; - //=============== Mzansi Profile =============== - temp.add({ - "Mzansi Profile": MzansiProfileTile( - packageSize: packageSize, - ) - }); - //=============== Mzansi Wallet =============== - temp.add({ - "Mzansi Wallet": MihWalletTile( - packageSize: packageSize, - ) - }); - //=============== Patient Profile =============== - temp.add({ - "Patient Profile": PatientProfileTile( - packageSize: packageSize, - ) - }); - //=============== Mzansi Directory =============== - temp.add({ - "Mzansi Directory": MzansiDirectoryTile( - packageSize: packageSize, - ) - }); - //=============== Calendar =============== - temp.add({ - "Calendar": MzansiCalendarTile( - packageSize: packageSize, - ) - }); - //=============== Mzansi AI =============== - temp.add({ - "Mzansi AI": MzansiAiTile( - packageSize: packageSize, - ) - }); - //=============== Calculator =============== - temp.add({ - "Calculator": MihCalculatorTile( - packageSize: packageSize, - ) - }); - //=============== Mine Sweeper =============== - temp.add({ - "Mine Sweeper": MihMineSweeperTile( - packageSize: packageSize, - ) - }); - //=============== MIH Access =============== - temp.add({ - "MIH Access": MihAccessTile( - packageSize: packageSize, - ) - }); - //=============== About MIH =============== - temp.add({ - "About MIH": AboutMihTile( - packageSize: packageSize, - ) - }); - //=============== Dev =============== - if (AppEnviroment.getEnv() == "Dev") { - temp.add({ - "test": TestPackageTile( - packageSize: packageSize, - ) - }); - } - return temp; - } - - EdgeInsets getPadding(double width, double height) { - if (MzansiInnovationHub.of(context)!.theme.screenType == "mobile") { - double mobilePadding = 10; - return EdgeInsets.only( - left: mobilePadding, - right: mobilePadding, - bottom: mobilePadding, - ); - } else { - return EdgeInsets.only( - left: width / 13, - right: width / 13, - bottom: height / 15, - ); - } - } - - void searchPackage() { - if (searchController.text.isEmpty) { - searchPackageName.value = personalPackagesMap; - } else { - List> temp = []; - for (var item in personalPackagesMap) { - if (item.keys.first.toLowerCase().contains(searchController.text)) { - temp.add(item); - } - } - searchPackageName.value = temp; - } - } - - void autoNavToProfile() { - WidgetsBinding.instance.addPostFrameCallback((_) { - context.goNamed( - 'mzansiProfileManage', - ); - }); - } - - @override - void dispose() { - super.dispose(); - searchController.removeListener(searchPackage); - searchController.dispose(); - _searchFocusNode.dispose(); - // _marqueeController.dispose(); - // _scrollController.dispose(); - } - - @override - void initState() { - super.initState(); - searchController.addListener(searchPackage); - MzansiProfileProvider profileProvider = - context.read(); - if (profileProvider.user!.username == "") { - personalPackagesMap = setNerUserPersonalPackage(); - autoNavToProfile(); - } else { - personalPackagesMap = setPersonalPackagesMap(); - } - searchPackage(); - } - - @override - Widget build(BuildContext context) { - final Size size = MediaQuery.sizeOf(context); - final double width = size.width; - final double height = size.height; - - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(width, height), - ); - } - - Widget getBody(double width, double height) { - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - MzansiAiProvider mzansiAiProvider, Widget? child) { - return Column( - children: [ - Visibility( - visible: profileProvider.user!.username != "", - child: Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: MihSearchBar( - controller: searchController, - hintText: "Ask Mzansi", - prefixIcon: Icons.search, - prefixAltIcon: MihIcons.mzansiAi, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - hintColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onPrefixIconTap: () { - mzansiAiProvider.ollamaProvider.resetChat(); - if (searchController.text.isNotEmpty) { - mzansiAiProvider - .setStartUpQuestion(searchController.text); - } - context.goNamed("mzansiAi"); - searchController.clear(); - }, - searchFocusNode: _searchFocusNode, - ), - ), - ), - const SizedBox(height: 10), - Expanded( - child: ValueListenableBuilder( - valueListenable: searchPackageName, - builder: (context, value, child) { - List filteredPackages = value - .where((package) => package.keys.first - .toLowerCase() - .contains(searchController.text.toLowerCase())) - .map((package) => package.values.first) - .toList(); - if (filteredPackages.isNotEmpty) { - return GridView.builder( - padding: getPadding(width, height), - itemCount: filteredPackages.length, - gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( - maxCrossAxisExtent: packageSize, - crossAxisSpacing: 5, - ), - itemBuilder: (context, index) { - return filteredPackages[index]; - }, - ); - } else { - return Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.mzansiAi, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - const SizedBox(height: 10), - Text( - "Mzansi AI is here to help you!", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ], - ); - } - }, - ), - ), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mine_sweeper/builders/build_minesweeper_leaderboard_list.dart b/mih_ui/lib/mih_packages/mine_sweeper/builders/build_minesweeper_leaderboard_list.dart deleted file mode 100644 index 2b9ed288..00000000 --- a/mih_ui/lib/mih_packages/mine_sweeper/builders/build_minesweeper_leaderboard_list.dart +++ /dev/null @@ -1,153 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_mine_sweeper_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:provider/provider.dart'; - -class BuildMinesweeperLeaderboardList extends StatefulWidget { - const BuildMinesweeperLeaderboardList({super.key}); - - @override - State createState() => - _BuildMinesweeperLeaderboardListState(); -} - -class _BuildMinesweeperLeaderboardListState - extends State { - Color getMedalColor(int index) { - switch (index) { - case (0): - return MihColors.getGoldColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - case (1): - return MihColors.getSilverColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - case (2): - return MihColors.getBronze( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - default: - return MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } - } - - @override - Widget build(BuildContext context) { - final double width = MediaQuery.sizeOf(context).width; - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - MihMineSweeperProvider mineSweeperProvider, Widget? child) { - return ListView.separated( - separatorBuilder: (BuildContext context, index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemCount: mineSweeperProvider.leaderboard!.length, - itemBuilder: (context, index) { - return FutureBuilder( - future: mineSweeperProvider.leaderboardUserPicturesUrl[index], - builder: (context, asyncSnapshot) { - ImageProvider? imageFile; - bool loading = true; - if (asyncSnapshot.connectionState == ConnectionState.done) { - loading = false; - if (asyncSnapshot.hasData) { - imageFile = asyncSnapshot.requireData != "" - ? CachedNetworkImageProvider( - asyncSnapshot.requireData) - : null; - } else { - imageFile = null; - } - } else { - imageFile = null; - } - return Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: Row( - children: [ - Text( - "#${index + 1}", - style: TextStyle( - fontSize: 25, - color: getMedalColor(index), - ), - ), - const SizedBox(width: 10), - loading - ? Icon( - MihIcons.mihRing, - size: 80, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ) - : imageFile == null - ? Icon( - MihIcons.iDontKnow, - size: 80, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ) - : MihCircleAvatar( - key: UniqueKey(), - imageFile: imageFile, - width: 80, - expandable: true, - editable: false, - fileNameController: null, - userSelectedfile: null, - frameColor: getMedalColor(index), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - onChange: () {}, - ), - const SizedBox(width: 10), - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "${mineSweeperProvider.leaderboard![index].username}${profileProvider.user!.username == mineSweeperProvider.leaderboard![index].username ? " (You)" : ""}", - textAlign: TextAlign.left, - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: getMedalColor(index), - ), - ), - Text( - "Score: ${mineSweeperProvider.leaderboard![index].game_score}\nTime: ${mineSweeperProvider.leaderboard![index].game_time}", - textAlign: TextAlign.left, - style: TextStyle( - fontSize: 18, - // fontWeight: FontWeight.bold, - color: getMedalColor(index), - ), - ), - ], - ) - ], - ), - ); - }); - }, - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mine_sweeper/builders/build_my_scoreboard_list.dart b/mih_ui/lib/mih_packages/mine_sweeper/builders/build_my_scoreboard_list.dart deleted file mode 100644 index 59f7f3a4..00000000 --- a/mih_ui/lib/mih_packages/mine_sweeper/builders/build_my_scoreboard_list.dart +++ /dev/null @@ -1,94 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_mine_sweeper_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:provider/provider.dart'; - -class BuildMyScoreBoardList extends StatefulWidget { - const BuildMyScoreBoardList({super.key}); - - @override - State createState() => - _BuildMinesweeperLeaderboardListState(); -} - -class _BuildMinesweeperLeaderboardListState - extends State { - Color getMedalColor(int index) { - switch (index) { - case (0): - return MihColors.getGoldColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - case (1): - return MihColors.getSilverColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - case (2): - return MihColors.getBronze( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - default: - return MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } - } - - @override - Widget build(BuildContext context) { - final double width = MediaQuery.sizeOf(context).width; - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - MihMineSweeperProvider mineSweeperProvider, Widget? child) { - return ListView.separated( - separatorBuilder: (BuildContext context, index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemCount: mineSweeperProvider.myScoreboard!.length, - itemBuilder: (context, index) { - return Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: Row( - children: [ - Text( - "#${index + 1}", - style: TextStyle( - fontSize: 25, - color: getMedalColor(index), - ), - ), - const SizedBox(width: 10), - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Score: ${mineSweeperProvider.myScoreboard![index].game_score}", - textAlign: TextAlign.left, - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: getMedalColor(index), - ), - ), - Text( - "Time: ${mineSweeperProvider.myScoreboard![index].game_time}", - textAlign: TextAlign.left, - style: TextStyle( - fontSize: 18, - // fontWeight: FontWeight.bold, - color: getMedalColor(index), - ), - ), - ], - ) - ], - ), - ); - }, - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mine_sweeper/components/board_square.dart b/mih_ui/lib/mih_packages/mine_sweeper/components/board_square.dart deleted file mode 100644 index 0259b064..00000000 --- a/mih_ui/lib/mih_packages/mine_sweeper/components/board_square.dart +++ /dev/null @@ -1,13 +0,0 @@ -class BoardSquare { - bool hasBomb; - int bombsAround; - bool isOpened; - bool isFlagged; - - BoardSquare({ - this.hasBomb = false, - this.bombsAround = 0, - this.isOpened = false, - this.isFlagged = false, - }); -} diff --git a/mih_ui/lib/mih_packages/mine_sweeper/components/leaderboard_user_ranking.dart b/mih_ui/lib/mih_packages/mine_sweeper/components/leaderboard_user_ranking.dart deleted file mode 100644 index 338189b7..00000000 --- a/mih_ui/lib/mih_packages/mine_sweeper/components/leaderboard_user_ranking.dart +++ /dev/null @@ -1,86 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:redacted/redacted.dart'; - -class LeaderboardUserRanking extends StatelessWidget { - final int index; - final String proPicUrl; - final String username; - final dynamic gameScore; - final String gameTime; - final bool isCurrentUser; - final Future?> Function(String) getUserPicture; - - const LeaderboardUserRanking({ - super.key, - required this.index, - required this.proPicUrl, - required this.username, - required this.gameScore, - required this.gameTime, - required this.isCurrentUser, - required this.getUserPicture, - }); - - @override - Widget build(BuildContext context) { - return FutureBuilder( - future: getUserPicture(proPicUrl), - builder: (context, asyncSnapshot) { - bool isLoading = - asyncSnapshot.connectionState == ConnectionState.waiting; - - KenLogger.success("URL: ${asyncSnapshot.data.toString()}"); - return ListTile( - leading: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - "#${index + 1}", - style: const TextStyle( - fontSize: 25, - ), - ), - const SizedBox(width: 10), - MihCircleAvatar( - key: ValueKey(asyncSnapshot.data - .toString()), // Use ValueKey for stable identity - imageFile: asyncSnapshot.data, - width: 60, - expandable: true, - editable: false, - fileNameController: null, - userSelectedfile: null, - frameColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onChange: () {}, - ), - ], - ), - title: Text( - "$username${isCurrentUser ? " (You)" : ""}", - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ).redacted(context: context, redact: isLoading), - subtitle: Text( - "Score: $gameScore\nTime: $gameTime", - style: TextStyle( - fontSize: 18, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ).redacted(context: context, redact: isLoading), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mine_sweeper/components/mih_mine_sweeper_start_game_window.dart b/mih_ui/lib/mih_packages/mine_sweeper/components/mih_mine_sweeper_start_game_window.dart deleted file mode 100644 index 5e2ed861..00000000 --- a/mih_ui/lib/mih_packages/mine_sweeper/components/mih_mine_sweeper_start_game_window.dart +++ /dev/null @@ -1,174 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_mine_sweeper_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:provider/provider.dart'; - -class MihMineSweeperStartGameWindow extends StatefulWidget { - final void Function()? onPressed; - const MihMineSweeperStartGameWindow({ - super.key, - required this.onPressed, - }); - - @override - State createState() => - _MihMineSweeperStartGameWindowState(); -} - -class _MihMineSweeperStartGameWindowState - extends State { - TextEditingController modeController = TextEditingController(); - final _formKey = GlobalKey(); - - void applyGameSettings(MihMineSweeperProvider mihMineSweeperProvider) { - mihMineSweeperProvider.setDifficulty(modeController.text); - switch (mihMineSweeperProvider.difficulty) { - case ("Very Easy"): - mihMineSweeperProvider.setRowCount(6); - mihMineSweeperProvider.setCoulmnCount(6); - mihMineSweeperProvider.setTotalMines(5); - // mihMineSweeperProvider.setRowCount(5); - // mihMineSweeperProvider.setCoulmnCount(5); - // mihMineSweeperProvider.setTotalMines(3); - break; - case ("Easy"): - mihMineSweeperProvider.setRowCount(8); - mihMineSweeperProvider.setCoulmnCount(8); - mihMineSweeperProvider.setTotalMines(10); - // mihMineSweeperProvider.setRowCount(10); - // mihMineSweeperProvider.setCoulmnCount(10); - // mihMineSweeperProvider.setTotalMines(15); - break; - case ("Intermediate"): - mihMineSweeperProvider.setRowCount(10); - mihMineSweeperProvider.setCoulmnCount(10); - mihMineSweeperProvider.setTotalMines(18); - // mihMineSweeperProvider.setRowCount(15); - // mihMineSweeperProvider.setCoulmnCount(10); - // mihMineSweeperProvider.setTotalMines(23); - break; - case ("Hard"): - mihMineSweeperProvider.setRowCount(12); - mihMineSweeperProvider.setCoulmnCount(10); - mihMineSweeperProvider.setTotalMines(30); - // mihMineSweeperProvider.setRowCount(20); - // mihMineSweeperProvider.setCoulmnCount(10); - // mihMineSweeperProvider.setTotalMines(30); - break; - default: - break; - } - } - - String getModeConfig() { - switch (modeController.text) { - case ("Very Easy"): - return "Columns: 6\nRows: 6\nBombs: 5"; - case ("Easy"): - return "Columns: 8\nRows: 8\nBombs: 10"; - case ("Intermediate"): - return "Columns: 10\nRows: 10\nBombs: 18"; - case ("Hard"): - return "Columns: 10\nRows: 12\nBombs: 30"; - default: - return "Error"; - } - } - - void _onModeChanged() { - setState(() {}); - } - - @override - void dispose() { - modeController.removeListener(_onModeChanged); - modeController.dispose(); - super.dispose(); - } - - @override - void initState() { - super.initState(); - modeController.text = context.read().difficulty; - modeController.addListener(_onModeChanged); - } - - @override - Widget build(BuildContext context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: "New Game Settings", - onWindowTapClose: () { - context.pop(); - }, - windowBody: Consumer( - builder: (BuildContext context, - MihMineSweeperProvider mihMineSweeperProvider, Widget? child) { - return Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - MihDropdownField( - controller: modeController, - hintText: "Difficulty", - dropdownOptions: [ - "Very Easy", - "Easy", - "Intermediate", - "Hard" - ], - requiredText: true, - editable: true, - enableSearch: false, - ), - const SizedBox(height: 10), - Text( - getModeConfig(), - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 25), - Center( - child: MihButton( - onPressed: () { - applyGameSettings(mihMineSweeperProvider); - context.pop(); - widget.onPressed?.call(); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Start Game", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ], - ); - }, - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mine_sweeper/components/mine_tile.dart b/mih_ui/lib/mih_packages/mine_sweeper/components/mine_tile.dart deleted file mode 100644 index d7d00a44..00000000 --- a/mih_ui/lib/mih_packages/mine_sweeper/components/mine_tile.dart +++ /dev/null @@ -1,112 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/components/board_square.dart'; - -class MineTile extends StatelessWidget { - final BoardSquare square; - final VoidCallback onTap; - final VoidCallback onLongPress; - - const MineTile({ - super.key, - required this.square, - required this.onTap, - required this.onLongPress, - }); - - Widget _getTileContent(BuildContext context) { - if (square.isFlagged) { - return Icon( - Icons.flag, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark", - ), - ); - } - - if (square.isOpened) { - if (square.hasBomb) { - return const Icon(FontAwesomeIcons.bomb, color: Colors.black); - } else if (square.bombsAround > 0) { - // Display bomb count - return Center( - child: Text( - '${square.bombsAround}', - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: _getTileColor(square.bombsAround, context), - ), - ), - ); - } else { - // Opened, but no bomb count (empty square) - return const SizedBox.shrink(); - } - } - - // Default: Unopened tile - return const SizedBox.shrink(); - } - - Color _getTileColor(int bombsAround, BuildContext context) { - // Choose colors based on standard Minesweeper appearance - switch (bombsAround) { - case 1: - return MihColors.getBluishPurpleColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark", - ); - // return Colors.blue; - case 2: - return MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark", - ); - // return Colors.green; - case 3: - return MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark", - ); - // return Colors.red; - case 4: - return MihColors.getPurpleColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark", - ); - // return Colors.purple; - case 5: - return MihColors.getOrangeColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark", - ); - // return Colors.brown; - default: - // return MihColors.getBluishPurpleColor( - // MzansiInnovationHub.of(context)!.theme.mode == "Dark", - // ); - return Colors.black; - } - } - - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.all(1.0), - child: MihButton( - onPressed: onTap, - onLongPressed: onLongPress, - buttonColor: square.isOpened - ? MihColors.getGreyColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark", - ) - : MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark", - ), - width: 50, - height: 50, - borderRadius: 3, - child: _getTileContent(context), - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mine_sweeper/mih_mine_sweeper.dart b/mih_ui/lib/mih_packages/mine_sweeper/mih_mine_sweeper.dart deleted file mode 100644 index c259798c..00000000 --- a/mih_ui/lib/mih_packages/mine_sweeper/mih_mine_sweeper.dart +++ /dev/null @@ -1,141 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_banner_ad_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_mine_sweeper_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/package_tools/mih_mine_sweeper_leader_board.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/package_tools/mine_sweeper_game.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/package_tools/mine_sweeper_quick_start_guide.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/package_tools/my_score_board.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_data_helper_services.dart'; -import 'package:provider/provider.dart'; - -class MihMineSweeper extends StatefulWidget { - const MihMineSweeper({super.key}); - - @override - State createState() => _MihMineSweeperState(); -} - -class _MihMineSweeperState extends State { - bool _isLoadingInitialData = true; - late final MineSweeperGame _mineSweeperGame; - late final MihMineSweeperLeaderBoard _mineSweeperLeaderBoard; - late final MyScoreBoard _myScoreBoard; - late final MineSweeperQuickStartGuide _mineSweeperQuickStartGuide; - - Future _loadInitialData() async { - setState(() { - _isLoadingInitialData = true; - }); - MzansiProfileProvider mzansiProfileProvider = - context.read(); - MihBannerAdProvider bannerAdProvider = context.read(); - if (mzansiProfileProvider.user == null) { - await MihDataHelperServices().loadUserDataOnly( - mzansiProfileProvider, - ); - } - bannerAdProvider.loadBannerAd(); - setState(() { - _isLoadingInitialData = false; - }); - } - - @override - void initState() { - super.initState(); - _mineSweeperGame = MineSweeperGame(); - _mineSweeperLeaderBoard = MihMineSweeperLeaderBoard(); - _myScoreBoard = MyScoreBoard(); - _mineSweeperQuickStartGuide = MineSweeperQuickStartGuide(); - _loadInitialData(); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: - (BuildContext context, MihMineSweeperProvider value, Widget? child) { - if (_isLoadingInitialData) { - return Scaffold( - body: Center( - child: Mihloadingcircle(), - ), - ); - } - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appToolTitles: getToolTitle(), - appBody: getToolBody(), - selectedbodyIndex: context.watch().toolIndex, - onIndexChange: (newIndex) { - context.read().setToolIndex(newIndex); - }, - ); - }, - ); - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - MihMineSweeperProvider mineSweeperProvider = - context.read(); - mineSweeperProvider.setToolIndex(0); - mineSweeperProvider.setDifficulty("Easy"); - context.goNamed( - 'mihHome', - ); - FocusScope.of(context).unfocus(); - }, - ); - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(FontAwesomeIcons.bomb)] = () { - context.read().setToolIndex(0); - }; - temp[const Icon(Icons.leaderboard_rounded)] = () { - context.read().setToolIndex(1); - }; - temp[const Icon(Icons.perm_identity_rounded)] = () { - context.read().setToolIndex(2); - }; - temp[const Icon(Icons.rule_rounded)] = () { - context.read().setToolIndex(3); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: context.watch().toolIndex, - ); - } - - List getToolTitle() { - List toolTitles = [ - "Minesweeper", - "Leader Board", - "My Scores", - "Guide", - ]; - return toolTitles; - } - - List getToolBody() { - return [ - _mineSweeperGame, - _mineSweeperLeaderBoard, - _myScoreBoard, - _mineSweeperQuickStartGuide, - ]; - } -} diff --git a/mih_ui/lib/mih_packages/mine_sweeper/package_tiles/mih_mine_sweeper_tile.dart b/mih_ui/lib/mih_packages/mine_sweeper/package_tiles/mih_mine_sweeper_tile.dart deleted file mode 100644 index 7171697d..00000000 --- a/mih_ui/lib/mih_packages/mine_sweeper/package_tiles/mih_mine_sweeper_tile.dart +++ /dev/null @@ -1,40 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihMineSweeperTile extends StatefulWidget { - final double packageSize; - const MihMineSweeperTile({ - super.key, - required this.packageSize, - }); - - @override - State createState() => _MihMineSweeperTileState(); -} - -class _MihMineSweeperTileState extends State { - @override - Widget build(BuildContext context) { - return MihPackageTile( - onTap: () { - context.goNamed( - "mihMinesweeper", - ); - }, - appName: "Minesweeper", - appIcon: Icon( - MihIcons.mineSweeper, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // size: widget.packageSize, - ), - iconSize: widget.packageSize, - textColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mine_sweeper/package_tools/mih_mine_sweeper_leader_board.dart b/mih_ui/lib/mih_packages/mine_sweeper/package_tools/mih_mine_sweeper_leader_board.dart deleted file mode 100644 index d2865b2a..00000000 --- a/mih_ui/lib/mih_packages/mine_sweeper/package_tools/mih_mine_sweeper_leader_board.dart +++ /dev/null @@ -1,201 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_mine_sweeper_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/builders/build_minesweeper_leaderboard_list.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_minesweeper_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:provider/provider.dart'; - -class MihMineSweeperLeaderBoard extends StatefulWidget { - const MihMineSweeperLeaderBoard({super.key}); - - @override - State createState() => - _MihMineSweeperLeaderBoardState(); -} - -class _MihMineSweeperLeaderBoardState extends State { - TextEditingController filterController = TextEditingController(); - bool isLoading = true; - Future initialiseLeaderboard() async { - MihMineSweeperProvider mineSweeperProvider = - context.read(); - filterController.text = mineSweeperProvider.difficulty; - KenLogger.success("getting data"); - await MihMinesweeperServices().getTop20Leaderboard(mineSweeperProvider); - List> userPicturesUrl = []; - Future userPicUrl; - for (final ranking in mineSweeperProvider.leaderboard!) { - userPicUrl = MihFileApi.getMinioFileUrl(ranking.proPicUrl); - userPicturesUrl.add(userPicUrl); - } - mineSweeperProvider.setLeaderboardUserPictures( - leaderboardUserPicturesUrl: userPicturesUrl); - setState(() { - isLoading = false; - }); - } - - void refreshLeaderBoard( - MihMineSweeperProvider mineSweeperProvider, String difficulty) { - setState(() { - isLoading = true; - }); - mineSweeperProvider.setDifficulty(difficulty); - mineSweeperProvider.setLeaderboard(leaderboard: null); - mineSweeperProvider.setMyScoreboard(myScoreboard: null); - initialiseLeaderboard(); - } - - @override - void initState() { - super.initState(); - WidgetsBinding.instance.addPostFrameCallback((_) async { - await initialiseLeaderboard(); - }); - } - - @override - Widget build(BuildContext context) { - final double width = MediaQuery.sizeOf(context).width; - return Consumer( - builder: (BuildContext context, - MihMineSweeperProvider mineSweeperProvider, Widget? child) { - return RefreshIndicator( - onRefresh: () async { - refreshLeaderBoard(mineSweeperProvider, filterController.text); - }, - child: MihPackageToolBody( - borderOn: false, - bodyItem: getBody(width), - ), - ); - }, - ); - } - - Widget getBody(double width) { - return Consumer( - builder: (BuildContext context, - MihMineSweeperProvider mineSweeperProvider, Widget? child) { - if (isLoading) { - return Center( - child: Mihloadingcircle(), - ); - } else { - return Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.max, - children: [ - Flexible( - child: MihDropdownField( - controller: filterController, - hintText: "Leaderboards", - dropdownOptions: const [ - "Very Easy", - "Easy", - "Intermediate", - "Hard", - ], - requiredText: true, - editable: true, - enableSearch: false, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - onSelected: (selection) { - refreshLeaderBoard(mineSweeperProvider, selection!); - }, - ), - ), - ], - ), - ), - const SizedBox(height: 10), - !isLoading && mineSweeperProvider.leaderboard!.isEmpty - ? Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.mineSweeper, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - const SizedBox(height: 10), - Text( - "Be the first on the leaderboard.", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - FontAwesomeIcons.bomb, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - TextSpan(text: " and start a new game"), - ], - ), - ), - ), - ], - ), - ) - : Expanded( - child: BuildMinesweeperLeaderboardList(), - ), - ], - ); - } - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mine_sweeper/package_tools/mine_sweeper_game.dart b/mih_ui/lib/mih_packages/mine_sweeper/package_tools/mine_sweeper_game.dart deleted file mode 100644 index 78ea28b9..00000000 --- a/mih_ui/lib/mih_packages/mine_sweeper/package_tools/mine_sweeper_game.dart +++ /dev/null @@ -1,865 +0,0 @@ -import 'dart:async'; -import 'dart:io'; -import 'dart:math'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_banner_ad.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_mine_sweeper_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/components/board_square.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/components/mih_mine_sweeper_start_game_window.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/components/mine_tile.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_minesweeper_services.dart'; -import 'package:provider/provider.dart'; - -class MineSweeperGame extends StatefulWidget { - const MineSweeperGame({super.key}); - - @override - State createState() => _MineSweeperGameState(); -} - -class _MineSweeperGameState extends State { - List> board = []; - bool isGameOver = false; - bool isGameWon = false; - int squaresLeft = -1; - Timer? _timer; - int _milliseconds = 0; - bool _isRunning = false; - static const int millisecondsPerUpdate = 100; - - double timeStringToTotalSeconds(String timeString) { - try { - List parts = timeString.split(':'); - if (parts.length != 4) { - return 0.0; - } - double hours = double.parse(parts[0]); - double minutes = double.parse(parts[1]); - double seconds = double.parse(parts[2]); - double milliseconds = double.parse(parts[3]); - double totalSeconds = - (hours * 3600) + (minutes * 60) + seconds + (milliseconds / 100); - return totalSeconds; - } catch (e) { - print("Error parsing time string: $e"); - return 0.0; - } - } - - double calculateGameScore(MihMineSweeperProvider mihMineSweeperProvider) { - int scoreConst = 10000; - double dificusltyMultiplier; - switch (mihMineSweeperProvider.difficulty) { - case ("Very Easy"): - dificusltyMultiplier = 0.5; - break; - case ("Easy"): - dificusltyMultiplier = 1.0; - break; - case ("Intermediate"): - dificusltyMultiplier = 2.5; - break; - case ("Hard"): - dificusltyMultiplier = 5.0; - break; - default: - dificusltyMultiplier = 0.0; - break; - } - double rawScore = (scoreConst * dificusltyMultiplier) / - timeStringToTotalSeconds(_formatTime()); - - String scoreString = rawScore.toStringAsFixed(5); - return double.parse(scoreString); - } - - void startTimer() { - if (_isRunning) return; - _isRunning = true; - _timer = Timer.periodic(const Duration(milliseconds: millisecondsPerUpdate), - (timer) { - setState(() { - _milliseconds += millisecondsPerUpdate; // Increment by the interval - }); - }); - } - - void stopTimer() { - _timer?.cancel(); - setState(() { - _isRunning = false; - }); - } - - void resetTimer() { - stopTimer(); // Stop the timer first - setState(() { - _milliseconds = 0; // Reset the time to zero - }); - } - - String _formatTime() { - Duration duration = Duration(milliseconds: _milliseconds); - final int hours = duration.inHours; - final int minutes = duration.inMinutes.remainder(60); - final int seconds = duration.inSeconds.remainder(60); - final int centiseconds = (duration.inMilliseconds.remainder(1000)) ~/ 10; - String hoursStr = hours.toString().padLeft(2, '0'); - String minutesStr = minutes.toString().padLeft(2, '0'); - String secondsStr = seconds.toString().padLeft(2, '0'); - String centiStr = centiseconds.toString().padLeft(2, '0'); - return '$hoursStr:$minutesStr:$secondsStr:$centiStr'; - } - - void showStartGameWindow( - MihMineSweeperProvider mihMineSweeperProvider, - ) { - // easy - 10 * 10 & 15 bombs - // Intermediate - 10 * 15 & 23 bombs - // Hard - 10 * 20 & 30 bombs - showDialog( - barrierDismissible: false, - context: context, - builder: (context) { - return MihMineSweeperStartGameWindow( - onPressed: () { - resetTimer(); - mihMineSweeperProvider - .setDifficulty(mihMineSweeperProvider.difficulty); - setState(() => initializeBoard(mihMineSweeperProvider)); - }, - ); - }); - } - -// --- GAME INITIALIZATION LOGIC --- - void initializeBoard(MihMineSweeperProvider mihMineSweeperProvider) { - // 1. Create a board of empty squares - board = List.generate( - mihMineSweeperProvider.rowCount, - (i) => List.generate( - mihMineSweeperProvider.columnCount, - (j) => BoardSquare(), - ), - ); - // 2. Place bombs randomly - placeBombs(mihMineSweeperProvider); - // 3. Calculate the number of bombs around each non-mine square - calculateBombsAround(mihMineSweeperProvider); - // Reset state variables - squaresLeft = - mihMineSweeperProvider.rowCount * mihMineSweeperProvider.columnCount; - isGameOver = false; - isGameWon = false; - // You'd typically add a call to setState here, but it's in initState. - startTimer(); - } - - void placeBombs(MihMineSweeperProvider mihMineSweeperProvider) { - final Random random = Random(); - int bombsPlaced = 0; - - while (bombsPlaced < mihMineSweeperProvider.totalMines) { - int r = random.nextInt(mihMineSweeperProvider.rowCount); - int c = random.nextInt(mihMineSweeperProvider.columnCount); - - if (!board[r][c].hasBomb) { - board[r][c].hasBomb = true; - bombsPlaced++; - } - } - } - - void calculateBombsAround(MihMineSweeperProvider mihMineSweeperProvider) { - for (int r = 0; r < mihMineSweeperProvider.rowCount; r++) { - for (int c = 0; c < mihMineSweeperProvider.columnCount; c++) { - if (!board[r][c].hasBomb) { - int count = 0; - - // Check the 8 neighbors - for (int i = -1; i <= 1; i++) { - for (int j = -1; j <= 1; j++) { - if (i == 0 && j == 0) continue; // Skip the current square - - int neighborR = r + i; - int neighborC = c + j; - - // Check if neighbor is within bounds - if (neighborR >= 0 && - neighborR < mihMineSweeperProvider.rowCount && - neighborC >= 0 && - neighborC < mihMineSweeperProvider.columnCount) { - if (board[neighborR][neighborC].hasBomb) { - count++; - } - } - } - } - board[r][c].bombsAround = count; - } - } - } - } - - // Handles recursive opening of zero-squares - void _expandZeros( - MihMineSweeperProvider mihMineSweeperProvider, int r, int c) { - if (r < 0 || - r >= mihMineSweeperProvider.rowCount || - c < 0 || - c >= mihMineSweeperProvider.columnCount || - board[r][c].isOpened) { - return; - } - - BoardSquare square = board[r][c]; - - // Open the current square - square.isOpened = true; - squaresLeft--; - - // If it's a zero square, recursively call for neighbors - if (square.bombsAround == 0) { - // Check all 8 neighbors (not just 4 sides, for standard Minesweeper expansion) - for (int i = -1; i <= 1; i++) { - for (int j = -1; j <= 1; j++) { - _expandZeros(mihMineSweeperProvider, r + i, c + j); - } - } - } - } - - Future handleTap(MzansiProfileProvider profileProvider, - MihMineSweeperProvider mihMineSweeperProvider, int r, int c) async { - if (isGameOver || board[r][c].isOpened || board[r][c].isFlagged) { - return; - } - // 1. Check for bomb (LOSS) - if (board[r][c].hasBomb) { - stopTimer(); - setState(() { - board[r][c].isOpened = true; - isGameOver = true; - // lose alert - loseAlert(mihMineSweeperProvider); - }); - return; - } - // 2. Open square and handle expansion (RECURSION) - if (board[r][c].bombsAround == 0) { - // Start recursive expansion - _expandZeros(mihMineSweeperProvider, r, c); - } else { - // Just open the single square - board[r][c].isOpened = true; - squaresLeft--; - } - // 3. Check for win - _checkWinCondition(profileProvider, mihMineSweeperProvider); - // Update the UI - setState(() {}); - } - - void handleLongPress(int r, int c) { - if (isGameOver || board[r][c].isOpened) { - return; - } - setState(() { - // Toggle the flag status - board[r][c].isFlagged = !board[r][c].isFlagged; - }); - } - - // --- GAME ACTION LOGIC --- - Future _checkWinCondition( - MzansiProfileProvider profileProvider, - MihMineSweeperProvider mihMineSweeperProvider, - ) async { - // Game is won if all non-mine squares are opened. - if (squaresLeft <= mihMineSweeperProvider.totalMines) { - stopTimer(); - isGameWon = true; - isGameOver = true; - // win alert - winAlert(mihMineSweeperProvider); - showDialog( - context: context, - builder: (context) { - return Mihloadingcircle( - message: "Uploading your score", - ); - }); - await MihMinesweeperServices().addPlayerScore( - profileProvider, - mihMineSweeperProvider, - _formatTime().replaceAll("00:", ""), - calculateGameScore(mihMineSweeperProvider), - ); - context.pop(); - } - } - - Color? getDifficultyColor(MihMineSweeperProvider mihMineSweeperProvider) { - String mode = mihMineSweeperProvider.difficulty; - switch (mode) { - case "Very Easy": - return MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark", - ); - case "Easy": - return MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark", - ); - case "Intermediate": - return MihColors.getOrangeColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark", - ); - case "Hard": - return MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark", - ); - default: - return null; - } - } - - void loseAlert(MihMineSweeperProvider mihMineSweeperProvider) { - showDialog( - barrierDismissible: false, - context: context, - builder: (context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - windowBody: Column( - children: [ - const SizedBox(height: 10), - Icon( - FontAwesomeIcons.bomb, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - size: 125, - ), - const SizedBox(height: 10), - Text( - "Better Luck Next Time", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - Center( - child: Text( - "Your lost this game of MIH Minesweeper!!!", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Text( - "Please feel free to start a New Game or check out the Leader Board to find out who's the best in Mzansi.", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 18, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 20), - Wrap( - runAlignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - alignment: WrapAlignment.center, - spacing: 10, - runSpacing: 10, - children: [ - MihButton( - onPressed: () { - context.pop(); - showStartGameWindow(mihMineSweeperProvider); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "New Game", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "View Board", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - context.pop(); - mihMineSweeperProvider.setToolIndex(1); - }, - buttonColor: MihColors.getGoldColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Leader Board", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ], - ), - ); - }, - ); - } - - void winAlert(MihMineSweeperProvider mihMineSweeperProvider) { - showDialog( - barrierDismissible: false, - context: context, - builder: (context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - windowBody: Column( - children: [ - const SizedBox(height: 10), - Icon( - Icons.celebration, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - size: 150, - ), - const SizedBox(height: 10), - Text( - "Congratulations", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - Text( - "Your won this game of MIH Minesweeper!!!", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 20, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 10), - Text( - "Time Taken: ${_formatTime().replaceAll("00:", "")}", - style: TextStyle( - fontSize: 20, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 10), - Text( - "Score: ${calculateGameScore(mihMineSweeperProvider)}", - style: TextStyle( - fontSize: 20, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 20), - Wrap( - runAlignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - alignment: WrapAlignment.center, - spacing: 10, - runSpacing: 10, - children: [ - MihButton( - onPressed: () { - context.pop(); - showStartGameWindow(mihMineSweeperProvider); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "New Game", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "View Board", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - mihMineSweeperProvider.setLeaderboard(leaderboard: null); - context.pop(); - mihMineSweeperProvider.setToolIndex(1); - }, - buttonColor: MihColors.getGoldColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Leader Board", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ], - ), - ); - }, - ); - } - - @override - void dispose() { - _timer?.cancel(); - super.dispose(); - } - - @override - void initState() { - // UBongani was here during the MIH Live - super.initState(); - } - - @override - Widget build(BuildContext context) { - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(), - ); - } - - Widget getBody() { - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - MihMineSweeperProvider mihMineSweeperProvider, Widget? child) { - return Column( - children: [ - Expanded( - child: Stack( - alignment: Alignment.topCenter, - children: [ - MihSingleChildScroll( - scrollbarOn: true, - child: board.isEmpty && squaresLeft < 0 - // Start Up Message before setting up game - ? Padding( - padding: - const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.mineSweeper, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - const SizedBox(height: 10), - Text( - "Welcom to Minesweeper, the first game of MIH.", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: - PlaceholderAlignment.middle, - child: Icon( - Icons.menu, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - TextSpan( - text: - " to start a new game or learn how to play the minesweeper."), - ], - ), - ), - ), - ], - ), - ) - // Display Game Board when game started - : Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - // Display game status - Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10.0), - child: Text( - 'Mines: ${mihMineSweeperProvider.totalMines}', - textAlign: TextAlign.left, - style: const TextStyle( - fontSize: 24, - fontWeight: FontWeight.bold), - ), - ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10.0), - child: Text( - _formatTime().replaceAll("00:", ""), - textAlign: TextAlign.right, - style: const TextStyle( - fontSize: 24, - fontWeight: FontWeight.bold), - ), - ), - ), - ], - ), - Text( - mihMineSweeperProvider.difficulty, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 24, - fontWeight: FontWeight.bold, - color: getDifficultyColor( - mihMineSweeperProvider), - ), - ), - - // const SizedBox( - // height: 30, - // ), - // The Board Grid - SizedBox( - width: mihMineSweeperProvider.columnCount * - 40.0, // Control size based on columns - height: mihMineSweeperProvider.rowCount * - 40.0, // Control size based on rows - child: GridView.builder( - physics: - const NeverScrollableScrollPhysics(), // Prevent scrolling - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: - mihMineSweeperProvider.columnCount, - crossAxisSpacing: 0, - mainAxisSpacing: 0, - ), - itemCount: mihMineSweeperProvider.rowCount * - mihMineSweeperProvider.columnCount, - itemBuilder: (context, index) { - int r = index ~/ - mihMineSweeperProvider - .columnCount; // Integer division for row - int c = index % - mihMineSweeperProvider - .columnCount; // Remainder for column - - return MineTile( - square: board[r][c], - onTap: () => handleTap(profileProvider, - mihMineSweeperProvider, r, c), - onLongPress: () => handleLongPress(r, c), - ); - }, - ), - ), - SizedBox(height: 30), - // const SizedBox(height: 100), - ], - ), - ), - Positioned( - right: 10, - bottom: 10, - child: MihFloatingMenu( - animatedIcon: AnimatedIcons.menu_close, - children: [ - SpeedDialChild( - child: Icon( - Icons.rule_rounded, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - label: "Learn how to play", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onTap: () { - mihMineSweeperProvider.setToolIndex(3); - }, - ), - SpeedDialChild( - child: Icon( - Icons.add, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - label: "Start New Game", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onTap: () { - showStartGameWindow(mihMineSweeperProvider); - }, - ), - ]), - ) - ], - ), - ), - _timer != null && !kIsWeb && (Platform.isAndroid || Platform.isIOS) - ? MihBannerAd() - : SizedBox(), - SizedBox(height: 15), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mine_sweeper/package_tools/mine_sweeper_quick_start_guide.dart b/mih_ui/lib/mih_packages/mine_sweeper/package_tools/mine_sweeper_quick_start_guide.dart deleted file mode 100644 index 5dcd790b..00000000 --- a/mih_ui/lib/mih_packages/mine_sweeper/package_tools/mine_sweeper_quick_start_guide.dart +++ /dev/null @@ -1,881 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MineSweeperQuickStartGuide extends StatefulWidget { - const MineSweeperQuickStartGuide({super.key}); - - @override - State createState() => - _MineSweeperQuickStartGuideState(); -} - -class _MineSweeperQuickStartGuideState - extends State { - double titleSize = 22.0; - double subtitleSize = 20.0; - double pointsSize = 18.0; - - Widget sectionOne() { - return Container( - decoration: BoxDecoration( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode != "Darl"), - borderRadius: BorderRadius.circular(15), - ), - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - // Title - Text( - "1. Two Main Actions\n(Your Controls)", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: titleSize, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 8), - //Part One - RichText( - text: TextSpan( - children: [ - TextSpan( - text: 'Quick Tap (or Click): This is the Dig action.', - style: TextStyle( - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode != - "Dark"), - fontWeight: FontWeight.bold, - fontSize: subtitleSize, - ), - ), - ], - ), - ), - const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: '• Goal:', - style: TextStyle( - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode != - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: ' To uncover a square and see a number clue.', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - ], - ), - ), - ), - ), - const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Align( - alignment: Alignment.centerLeft, - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: '• Risk:', - style: TextStyle( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: ' If you click a mine, the game ends!', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - ], - ), - ), - ), - ), - const SizedBox(height: 8), - //Part Two - RichText( - text: TextSpan( - children: [ - TextSpan( - text: - 'Tap and Hold (or Long Press): This is the Flag action (🚩).', - style: TextStyle( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != - "Dark"), - fontWeight: FontWeight.bold, - fontSize: subtitleSize, - ), - ), - ], - ), - ), - const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: '• Goal:', - style: TextStyle( - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode != - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: ' To safely mark a square that you are', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - TextSpan( - text: ' certain', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: ' is a mine.', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - ], - ), - ), - ), - ), - const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Align( - alignment: Alignment.centerLeft, - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: '• Risk:', - style: TextStyle( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: - ' Accidental placement of flags will cause confusion.', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - ], - ), - ), - ), - ), - const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Align( - alignment: Alignment.centerLeft, - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: '• Benefit:', - style: TextStyle( - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode != - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: - ' You cannot accidentally click a square that is flagged.', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), - ); - } - - Widget sectionTwo() { - return Container( - decoration: BoxDecoration( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode != "Darl"), - borderRadius: BorderRadius.circular(15), - ), - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - // Title - Text( - "2. The Golden Rule\n(Reading the Numbers)", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: titleSize, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 8), - //Part One - RichText( - text: TextSpan( - children: [ - TextSpan( - text: - 'The number tells you exactly how many mines are touching that square (including sides and corners).', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: subtitleSize, - ), - ), - ], - ), - ), - const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: "• If you see a Blank Space (a '0'):", - style: TextStyle( - color: MihColors.getOrangeColor( - MzansiInnovationHub.of(context)!.theme.mode != - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: " Zero (0) ", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: - ' mines are touching it. All surrounding squares are safe, and the game will open them for you automatically.', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - ], - ), - ), - ), - ), - const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Align( - alignment: Alignment.centerLeft, - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: "• If you see a '1':", - style: TextStyle( - color: MihColors.getOrangeColor( - MzansiInnovationHub.of(context)!.theme.mode != - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: ' Only ', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - TextSpan( - text: 'one', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: - ' mine is touching this square. You must find and flag that single mine.', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - ], - ), - ), - ), - ), - const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: "• If you see a '3':", - style: TextStyle( - color: MihColors.getOrangeColor( - MzansiInnovationHub.of(context)!.theme.mode != - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: " Three ", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: - 'mines are touching this square. You must find and flag all three.', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), - ); - } - - Widget sectionThree() { - return Container( - decoration: BoxDecoration( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode != "Darl"), - borderRadius: BorderRadius.circular(15), - ), - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - // Title - Text( - "3. The Winning Strategy\n(The Deduction Loop)", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: titleSize, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 8), - //Part One - RichText( - text: TextSpan( - children: [ - TextSpan( - text: - 'The game is won by uncovering every single safe square and correctly flagging all the mines. Use this two-step loop to clear the board:', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: subtitleSize, - ), - ), - ], - ), - ), - const SizedBox(height: 8), - RichText( - text: TextSpan( - children: [ - TextSpan( - text: 'A. Find the Mines (Where to Flag 🚩)', - style: TextStyle( - color: MihColors.getPurpleColor( - MzansiInnovationHub.of(context)!.theme.mode != - "Dark"), - fontWeight: FontWeight.bold, - fontSize: subtitleSize, - ), - ), - ], - ), - ), - const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: '• Goal:', - style: TextStyle( - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode != - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: - ' Look for a number that only has one choice for a mine. e.g. If a \'1\' is touching only one hidden square, that hidden square', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - TextSpan( - text: ' must ', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: 'be the mine.', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - ], - ), - ), - ), - ), - const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Align( - alignment: Alignment.centerLeft, - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: '• Action:', - style: TextStyle( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: ' Tap and Hold to place a', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - TextSpan( - text: ' Flag ', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: 'on the square you are sure is a mine.', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - ], - ), - ), - ), - ), - const SizedBox(height: 8), - //Part Two - RichText( - text: TextSpan( - children: [ - TextSpan( - text: 'B. Find the Safe Squares (Where to Dig)', - style: TextStyle( - color: MihColors.getPurpleColor( - MzansiInnovationHub.of(context)!.theme.mode != - "Dark"), - fontWeight: FontWeight.bold, - fontSize: subtitleSize, - ), - ), - ], - ), - ), - const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: '• Goal:', - style: TextStyle( - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode != - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: - ' Look for a number that has been \'satisfied\' by your flags. e.g. You see a \'2\' and you have already placed two 🚩 flags touching it. The \'2\' is satisfied.', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - ], - ), - ), - ), - ), - const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Align( - alignment: Alignment.centerLeft, - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: '• Action:', - style: TextStyle( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: - ' Quick Tap any of the remaining hidden squares touching that \'satisfied\' number. They', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - TextSpan( - text: ' must be safe ', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: - 'because the mine requirement has already been met.', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), - ); - } - - Widget sectionFour() { - return Container( - decoration: BoxDecoration( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode != "Darl"), - borderRadius: BorderRadius.circular(15), - ), - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - // Title - Text( - "✨ Key Beginner Tips", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: titleSize, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: "• Start on the Edges and Corners: ", - style: TextStyle( - color: MihColors.getBronze( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: - 'Numbers on the edge or corner of the board are easier to solve because they have fewer surrounding squares to check.', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - ], - ), - ), - ), - ), - const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: "• Don't Guess: ", - style: TextStyle( - color: MihColors.getBronze( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - fontSize: pointsSize, - ), - ), - TextSpan( - text: - 'If you are down to two squares and either one could be the mine, look somewhere else on the board for a guaranteed, safe move.', - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.normal, - fontSize: pointsSize, - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), - ); - } - - @override - Widget build(BuildContext context) { - final Size size = MediaQuery.sizeOf(context); - final double width = size.width; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(width), - ); - } - - Widget getBody(double width) { - return MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: Column( - children: [ - const Text( - 'Simple Rules and Strategy', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 8), - const Text( - 'Minesweeper is a puzzle game where you use numbers to figure out where the hidden bombs (mines) are located.', - style: TextStyle(fontSize: 18), - ), - // const Divider(height: 30), - const SizedBox(height: 15), - sectionOne(), - const SizedBox(height: 15), - sectionTwo(), - const SizedBox(height: 15), - sectionThree(), - const SizedBox(height: 15), - sectionFour(), - const SizedBox(height: 15), - ], - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mine_sweeper/package_tools/my_score_board.dart b/mih_ui/lib/mih_packages/mine_sweeper/package_tools/my_score_board.dart deleted file mode 100644 index 25433358..00000000 --- a/mih_ui/lib/mih_packages/mine_sweeper/package_tools/my_score_board.dart +++ /dev/null @@ -1,205 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_mine_sweeper_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/builders/build_my_scoreboard_list.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_minesweeper_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:provider/provider.dart'; - -class MyScoreBoard extends StatefulWidget { - const MyScoreBoard({super.key}); - - @override - State createState() => _MihMineSweeperLeaderBoardState(); -} - -class _MihMineSweeperLeaderBoardState extends State { - TextEditingController filterController = TextEditingController(); - - Future initialiseLeaderboard() async { - MzansiProfileProvider profileProvider = - context.read(); - MihMineSweeperProvider mineSweeperProvider = - context.read(); - filterController.text = mineSweeperProvider.difficulty; - KenLogger.success("getting data"); - await MihMinesweeperServices() - .getMyScoreboard(profileProvider, mineSweeperProvider); - KenLogger.success("${mineSweeperProvider.myScoreboard}"); - } - - void refreshLeaderBoard( - MihMineSweeperProvider mineSweeperProvider, String difficulty) { - mineSweeperProvider.setDifficulty(difficulty); - mineSweeperProvider.setLeaderboard(leaderboard: null); - mineSweeperProvider.setMyScoreboard(myScoreboard: null); - initialiseLeaderboard(); - } - - @override - void initState() { - super.initState(); - WidgetsBinding.instance.addPostFrameCallback((_) async { - await initialiseLeaderboard(); - }); - } - - @override - Widget build(BuildContext context) { - final double width = MediaQuery.sizeOf(context).width; - return Consumer( - builder: (BuildContext context, - MihMineSweeperProvider mineSweeperProvider, Widget? child) { - return RefreshIndicator( - onRefresh: () async { - refreshLeaderBoard(mineSweeperProvider, filterController.text); - }, - child: MihPackageToolBody( - borderOn: false, - bodyItem: getBody(width), - ), - ); - }, - ); - } - - Widget getBody(double width) { - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - MihMineSweeperProvider mineSweeperProvider, Widget? child) { - if (mineSweeperProvider.myScoreboard == null) { - return Center( - child: Mihloadingcircle(), - ); - } else { - return Column( - children: [ - Center( - child: MihCircleAvatar( - imageFile: profileProvider.userProfilePicture, - width: 150, - expandable: true, - editable: false, - fileNameController: null, - userSelectedfile: null, - frameColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onChange: (selectedImage) {}, - key: ValueKey(profileProvider.userProfilePicUrl), - ), - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.max, - children: [ - Flexible( - child: MihDropdownField( - controller: filterController, - hintText: "Scoreboards", - dropdownOptions: const [ - "Very Easy", - "Easy", - "Intermediate", - "Hard", - ], - requiredText: true, - editable: true, - enableSearch: false, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - onSelected: (selection) { - refreshLeaderBoard(mineSweeperProvider, selection!); - }, - ), - ), - ], - ), - ), - const SizedBox(height: 10), - mineSweeperProvider.myScoreboard!.isEmpty - ? Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.mineSweeper, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - const SizedBox(height: 10), - Text( - "You have played and ${mineSweeperProvider.difficulty} yet.", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - FontAwesomeIcons.bomb, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - TextSpan(text: " and start a new game"), - ], - ), - ), - ), - ], - ), - ) - : Expanded(child: BuildMyScoreBoardList()), - ], - ); - } - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_ai/mzansi_ai.dart b/mih_ui/lib/mih_packages/mzansi_ai/mzansi_ai.dart deleted file mode 100644 index 9d7de91d..00000000 --- a/mih_ui/lib/mih_packages/mzansi_ai/mzansi_ai.dart +++ /dev/null @@ -1,111 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_ai_provider.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_ai/package_tools/mih_ai_chat.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_data_helper_services.dart'; -import 'package:provider/provider.dart'; - -class MzansiAi extends StatefulWidget { - const MzansiAi({ - super.key, - }); - - @override - State createState() => _MzansiAiState(); -} - -class _MzansiAiState extends State { - bool _isLoadingInitialData = true; - late final MihAiChat _aiChat; - - Future _loadInitialData() async { - setState(() { - _isLoadingInitialData = true; - }); - MzansiProfileProvider mzansiProfileProvider = - context.read(); - if (mzansiProfileProvider.user == null) { - await MihDataHelperServices().loadUserDataOnly( - mzansiProfileProvider, - ); - } - setState(() { - _isLoadingInitialData = false; - }); - } - - @override - void initState() { - super.initState(); - _aiChat = MihAiChat(); - _loadInitialData(); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, MzansiAiProvider value, Widget? child) { - if (_isLoadingInitialData) { - return Scaffold( - body: Center( - child: Mihloadingcircle(), - ), - ); - } - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: getToolTitle(), - selectedbodyIndex: context.watch().toolIndex, - onIndexChange: (newValue) { - context.read().setToolIndex(newValue); - }, - ); - }, - ); - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - context.read().setStartUpQuestion(null); - context.goNamed( - 'mihHome', - ); - FocusScope.of(context).unfocus(); - }, - ); - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.chat)] = () { - context.read().setToolIndex(0); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: context.watch().toolIndex, - ); - } - - List getToolBody() { - return [ - _aiChat, - ]; - } - - List getToolTitle() { - List toolTitles = [ - "Ask Mzansi", - ]; - return toolTitles; - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_ai/package_tiles/mzansi_ai_tile.dart b/mih_ui/lib/mih_packages/mzansi_ai/package_tiles/mzansi_ai_tile.dart deleted file mode 100644 index 47c94016..00000000 --- a/mih_ui/lib/mih_packages/mzansi_ai/package_tiles/mzansi_ai_tile.dart +++ /dev/null @@ -1,48 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MzansiAiTile extends StatefulWidget { - final double packageSize; - - const MzansiAiTile({ - super.key, - required this.packageSize, - }); - - @override - State createState() => _MzansiAiTileState(); -} - -class _MzansiAiTileState extends State { - @override - Widget build(BuildContext context) { - return MihPackageTile( - onTap: () { - context.goNamed( - 'mzansiAi', - ); - // Navigator.of(context).pushNamed( - // '/mzansi-ai', - // arguments: MzansiAiArguments( - // widget.signedInUser, - // "", - // ), - // ); - }, - appName: "Mzansi AI", - appIcon: Icon( - MihIcons.mzansiAi, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // size: widget.packageSize, - ), - iconSize: widget.packageSize, - textColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_ai/package_tools/mih_ai_chat.dart b/mih_ui/lib/mih_packages/mzansi_ai/package_tools/mih_ai_chat.dart deleted file mode 100644 index 7cb268fc..00000000 --- a/mih_ui/lib/mih_packages/mzansi_ai/package_tools/mih_ai_chat.dart +++ /dev/null @@ -1,416 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_ai_toolkit/flutter_ai_toolkit.dart'; -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:flutter_tts/flutter_tts.dart'; -import 'package:intl/intl.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_ai_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:provider/provider.dart'; - -class MihAiChat extends StatefulWidget { - const MihAiChat({super.key}); - - @override - State createState() => _MihAiChatState(); -} - -class _MihAiChatState extends State with WidgetsBindingObserver { - final FlutterTts _flutterTts = FlutterTts(); - bool _isKeyboardVisible = false; - - Widget noMessagescDisplay() { - return Center( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.mzansiAi, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "Mzansi AI is here to help", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - children: [ - TextSpan( - text: - "Send us a message and we'll try our best to assist you"), - ], - ), - ), - ), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - Icons.menu, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - TextSpan(text: " to start a new chat or read last message"), - ], - ), - ), - ), - ], - ), - ), - ); - } - - void resetChat(MzansiAiProvider aiProvider) { - aiProvider.ollamaProvider.resetChat(); - } - - void speakLastMessage(MzansiAiProvider aiProvider) { - final history = aiProvider.ollamaProvider.history; - if (history.isEmpty) return; - - final historyList = history.toList(); - String? textToSpeak; - - // Find the last LLM message - for (int i = historyList.length - 1; i >= 0; i--) { - if (historyList[i].origin == MessageOrigin.llm && - historyList[i].text != null && - historyList[i].text!.isNotEmpty) { - textToSpeak = historyList[i].text!; - break; - } - } - - if (textToSpeak != null) { - if (!kIsWeb && Platform.isLinux) { - // Linux Workaround: Use Speech Dispatcher (standard on most distros) - // '-t female1' is optional for voice variety - Process.run('spd-say', [textToSpeak]); - - // Since spd-say doesn't have an easy "completion handler" via CLI, - // we manually toggle the UI state or just leave it off. - aiProvider.setTTSstate(true); - Future.delayed( - Duration(seconds: 5), () => aiProvider.setTTSstate(false)); - } else { - // Your existing mobile/web logic - _flutterTts.speak(textToSpeak); - } - } - } - - void saveHistory( - MzansiProfileProvider profileProvider, MzansiAiProvider aiProvider) { - final history = aiProvider.ollamaProvider.history.toList(); - DateTime now = DateTime.now(); - DateFormat formatter = DateFormat('yyyy-MM-ddTHH:mm:ss'); - String formattedDateTimeNow = formatter.format(now); - - // 1. Build the list of message Maps - List> messages = []; - for (int i = 0; i < history.length; i++) { - final map = history[i].toJson(); - map["order"] = i; // Add the order field - messages.add(map); - } - - // 2. Build the main history Map (the root JSON object) - final historyMap = { - "conversation_id": "1234-asdf-5678-qwert", - "app_id": profileProvider.user!.app_id, - "modified_date": formattedDateTimeNow, - "messages": messages, // The list of messages is included here - }; - - // 3. Use JsonEncoder to convert the entire Map to a formatted JSON string - const encoder = JsonEncoder.withIndent(' '); - String jsonHistory = encoder.convert(historyMap); - - // The output string will now be a correctly formatted and escaped JSON object. - debugPrint("History: $jsonHistory"); - } - - // void saveHistory( - // MzansiProfileProvider profileProvider, MzansiAiProvider aiProvider) { - // final history = aiProvider.ollamaProvider.history.toList(); - // DateTime now = DateTime.now(); - // DateFormat formatter = DateFormat('yyyy-MM-ddTHH:mm:ss'); - // String formattedDateTimeNow = formatter.format(now); - // String jsonHistory = '{"conversation_id":"1234-asdf-5678-qwert",\n'; - // jsonHistory += '"app_id":"${profileProvider.user!.app_id}",\n'; - // jsonHistory += '"modified_date":"$formattedDateTimeNow",\n'; - // jsonHistory += '"messages":[\n'; - // KenLogger.success("History Length: ${history.length}"); - // for (int i = 0; i != history.length; i++) { - // final map = history[i].toJson(); - // map["order"] = i; - // final json = JsonEncoder.withIndent(' ').convert(map); - // jsonHistory += json; - // if (i != history.length - 1) { - // KenLogger.success("i: $i"); - // jsonHistory += ","; - // } - // jsonHistory += "\n"; - // } - // jsonHistory += ']}'; - // debugPrint("History: $jsonHistory"); - // } - - void stopTTS(MzansiAiProvider aiProvider) { - if (!kIsWeb && Platform.isLinux) { - Process.run('spd-say', ['-S']); // The -S flag stops current speech - } else { - _flutterTts.stop(); - } - aiProvider.setTTSstate(false); - } - - Future initTts(MzansiAiProvider aiProvider) async { - if (!kIsWeb && Platform.isLinux) return; - try { - await _flutterTts.setSpeechRate(!kIsWeb ? 0.55 : 1); - // await _flutterTts.setLanguage("en-US"); - - // Safer voice selection with error handling - _flutterTts.getVoices.then((data) { - try { - final voices = List.from(data); - final englishVoices = voices.where((voice) { - final name = voice["name"]?.toString().toLowerCase() ?? ''; - final locale = voice["locale"]?.toString().toLowerCase() ?? ''; - return name.contains("en-us") || locale.contains("en_us"); - }).toList(); - - if (englishVoices.isNotEmpty) { - // Use the first available English voice - _flutterTts.setVoice({"name": englishVoices.first["name"]}); - } - // If no voices found, use default - } catch (e) { - KenLogger.error("Error setting TTS voice: $e"); - } - }); - } catch (e) { - KenLogger.error("Error initializing TTS: $e"); - } - - _flutterTts.setStartHandler(() { - if (mounted) { - aiProvider.setTTSstate(true); - } - }); - - _flutterTts.setCompletionHandler(() { - if (mounted) { - aiProvider.setTTSstate(false); - } - }); - - _flutterTts.setErrorHandler((message) { - if (mounted) { - aiProvider.setTTSstate(false); - } - }); - } - - void initStartQuestion() { - WidgetsBinding.instance.addPostFrameCallback((_) async { - final mzansiAiProvider = context.read(); - final startQuestion = mzansiAiProvider.startUpQuestion; - if (startQuestion != null && startQuestion.isNotEmpty) { - final stream = - mzansiAiProvider.ollamaProvider.sendMessageStream(startQuestion); - stream.listen((chunk) {}); - mzansiAiProvider.clearStartUpQuestion(); - } - }); - } - - @override - void initState() { - super.initState(); - MzansiAiProvider aiProvider = context.read(); - initTts(aiProvider); - initStartQuestion(); - WidgetsBinding.instance.addObserver(this); - } - - @override - void dispose() { - if (!kIsWeb && !Platform.isLinux) { - _flutterTts.stop(); - } - WidgetsBinding.instance.removeObserver(this); - super.dispose(); - } - - @override - void didChangeMetrics() { - final bottomInset = WidgetsBinding - .instance.platformDispatcher.views.first.viewInsets.bottom; - setState(() { - _isKeyboardVisible = bottomInset > 0; - }); - } - - @override - Widget build(BuildContext context) { - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - MzansiAiProvider aiProvider, Widget? child) { - bool hasHistory = aiProvider.ollamaProvider.history.isNotEmpty; - String? lastMessage; - if (hasHistory) { - final histroyList = aiProvider.ollamaProvider.history.toList(); - lastMessage = histroyList[histroyList.length - 1].text; - } - - return Stack( - children: [ - LlmChatView( - provider: aiProvider.ollamaProvider, - messageSender: aiProvider.ollamaProvider.sendMessageStream, - speechToText: aiProvider.ollamaProvider.speechToText, - // welcomeMessage: - // "Mzansi AI is here to help. Send us a messahe and we'll try our best to assist you.", - autofocus: false, - enableAttachments: true, - enableVoiceNotes: false, - style: aiProvider.getChatStyle(context), - suggestions: [ - "What is MIH all about?", - "What are the features of MIH?" - ], - ), - // Positioned( - // top: 10, - // left: 10, - // child: MihButton( - // width: 200, - // height: 30, - // onPressed: () { - // saveHistory(profileProvider, aiProvider); - // }, - // buttonColor: MihColors.getGreenColor( - // MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // child: Text( - // "View History as json", - // style: TextStyle( - // color: MihColors.getPrimaryColor( - // MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - // ), - // ), - // ), - if (hasHistory && lastMessage != null) - Positioned( - bottom: 80, - left: 10, - child: MihButton( - width: 35, - height: 35, - onPressed: () { - if (!aiProvider.ttsOn) { - speakLastMessage(aiProvider); - } else { - stopTTS(aiProvider); - } - }, - buttonColor: !aiProvider.ttsOn - ? MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark") - : MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - child: Icon( - !aiProvider.ttsOn ? Icons.volume_up : Icons.volume_off, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ), - Positioned( - right: 10, - bottom: 80, - child: MihFloatingMenu( - animatedIcon: AnimatedIcons.menu_close, - children: [ - SpeedDialChild( - child: Icon( - Icons.refresh, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - label: "New Chat", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - resetChat(aiProvider); - }, - ), - ], - ), - ), - if (!hasHistory && !_isKeyboardVisible) noMessagescDisplay(), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_directory/builders/build_business_search_resultsList.dart b/mih_ui/lib/mih_packages/mzansi_directory/builders/build_business_search_resultsList.dart deleted file mode 100644 index 0861cf7b..00000000 --- a/mih_ui/lib/mih_packages/mzansi_directory/builders/build_business_search_resultsList.dart +++ /dev/null @@ -1,96 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_business_profile_preview.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:provider/provider.dart'; - -class BuildBusinessSearchResultsList extends StatefulWidget { - final List businessList; - const BuildBusinessSearchResultsList({ - super.key, - required this.businessList, - }); - - @override - State createState() => - _BuildBusinessSearchResultsListState(); -} - -class _BuildBusinessSearchResultsListState - extends State { - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, MzansiDirectoryProvider directoryProvider, - Widget? child) { - return ListView.separated( - // shrinkWrap: true, - // physics: const NeverScrollableScrollPhysics(), - itemCount: widget.businessList.length, - separatorBuilder: (BuildContext context, index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemBuilder: (context, index) { - return Material( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: InkWell( - onTap: () { - directoryProvider.setSelectedBusiness( - business: widget.businessList[index], - ); - context.pushNamed( - 'businessProfileView', - ); - }, - splashColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark") - .withOpacity(0.2), - borderRadius: BorderRadius.circular(15), - child: Padding( - padding: EdgeInsetsGeometry.symmetric( - // vertical: 5, - horizontal: 25, - ), - child: FutureBuilder( - future: directoryProvider.busSearchImagesUrl![ - widget.businessList[index].business_id], - builder: (context, asyncSnapshot) { - ImageProvider? imageFile; - bool loading = true; - if (asyncSnapshot.connectionState == - ConnectionState.done) { - loading = false; - if (asyncSnapshot.hasData) { - imageFile = asyncSnapshot.requireData != "" - ? CachedNetworkImageProvider( - asyncSnapshot.requireData) - : null; - } else { - imageFile = null; - } - } else { - imageFile = null; - } - return MihBusinessProfilePreview( - business: widget.businessList[index], - imageFile: imageFile, - loading: loading, - ); - }), - ), - ), - ); - }, - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_directory/builders/build_favourite_businesses_list.dart b/mih_ui/lib/mih_packages/mzansi_directory/builders/build_favourite_businesses_list.dart deleted file mode 100644 index 74fa0c35..00000000 --- a/mih_ui/lib/mih_packages/mzansi_directory/builders/build_favourite_businesses_list.dart +++ /dev/null @@ -1,100 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_business_profile_preview.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:provider/provider.dart'; - -class BuildFavouriteBusinessesList extends StatefulWidget { - final List favouriteBusinesses; - const BuildFavouriteBusinessesList({ - super.key, - required this.favouriteBusinesses, - }); - - @override - State createState() => - _BuildFavouriteBusinessesListState(); -} - -class _BuildFavouriteBusinessesListState - extends State { - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, MzansiDirectoryProvider directoryProvider, - Widget? child) { - return ListView.separated( - itemCount: widget.favouriteBusinesses.length, - separatorBuilder: (BuildContext context, index) { - return Divider( - color: Theme.of(context).colorScheme.secondary, - ); - }, - itemBuilder: (context, index) { - if (widget.favouriteBusinesses[index] == null) { - return const SizedBox(); // Or a placeholder if a business couldn't be loaded - } - return Material( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: InkWell( - onTap: () { - directoryProvider.setSelectedBusiness( - business: widget.favouriteBusinesses[index]!, - ); - context.pushNamed( - 'businessProfileView', - ); - }, - splashColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark") - .withOpacity(0.2), - borderRadius: BorderRadius.circular(15), - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 25, - ), - child: FutureBuilder( - future: directoryProvider.favBusImagesUrl![ - widget.favouriteBusinesses[index]!.business_id], - builder: (context, asyncSnapshot) { - ImageProvider? imageFile; - bool loading = true; - if (asyncSnapshot.connectionState == - ConnectionState.done) { - loading = false; - if (asyncSnapshot.hasData) { - imageFile = asyncSnapshot.requireData != "" - ? CachedNetworkImageProvider( - asyncSnapshot.requireData) - : null; - } else { - imageFile = null; - } - } else { - imageFile = null; - } - return MihBusinessProfilePreview( - business: widget.favouriteBusinesses[index]!, - imageFile: imageFile, - loading: loading, - ); - }), - ), - ), - ); - }, - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_directory/builders/build_user_search_results_list.dart b/mih_ui/lib/mih_packages/mzansi_directory/builders/build_user_search_results_list.dart deleted file mode 100644 index 2d50b15e..00000000 --- a/mih_ui/lib/mih_packages/mzansi_directory/builders/build_user_search_results_list.dart +++ /dev/null @@ -1,95 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_personal_profile_preview.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:provider/provider.dart'; - -class BuildUserSearchResultsList extends StatefulWidget { - final List userList; - const BuildUserSearchResultsList({ - super.key, - required this.userList, - }); - - @override - State createState() => - _BuildUserSearchResultsListState(); -} - -class _BuildUserSearchResultsListState - extends State { - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, MzansiDirectoryProvider directoryProvider, - Widget? child) { - return ListView.separated( - // shrinkWrap: true, - // physics: const NeverScrollableScrollPhysics(), - itemCount: widget.userList.length, - separatorBuilder: (BuildContext context, index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemBuilder: (context, index) { - return Material( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: InkWell( - onTap: () { - directoryProvider.setSelectedUser( - user: widget.userList[index]); - context.pushNamed( - 'mzansiProfileView', - ); - }, - splashColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark") - .withOpacity(0.2), - borderRadius: BorderRadius.circular(15), - child: Padding( - padding: EdgeInsetsGeometry.symmetric( - // vertical: 5, - horizontal: 25, - ), - child: FutureBuilder( - future: directoryProvider - .userSearchImagesUrl![widget.userList[index].app_id], - builder: (context, asyncSnapshot) { - ImageProvider? imageFile; - bool loading = true; - if (asyncSnapshot.connectionState == - ConnectionState.done) { - loading = false; - if (asyncSnapshot.hasData) { - imageFile = asyncSnapshot.requireData != "" - ? CachedNetworkImageProvider( - asyncSnapshot.requireData) - : null; - } else { - imageFile = null; - } - } else { - imageFile = null; - } - return MihPersonalProfilePreview( - user: widget.userList[index], - imageFile: imageFile, - loading: loading, - ); - }), - ), - ), - ); - }, - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_directory/mzansi_directory.dart b/mih_ui/lib/mih_packages/mzansi_directory/mzansi_directory.dart deleted file mode 100644 index 207eb19b..00000000 --- a/mih_ui/lib/mih_packages/mzansi_directory/mzansi_directory.dart +++ /dev/null @@ -1,136 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:geolocator/geolocator.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/package_tools/mih_favourite_businesses.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/package_tools/mih_search_mzansi.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_data_helper_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_location_services.dart'; -import 'package:provider/provider.dart'; - -class MzansiDirectory extends StatefulWidget { - const MzansiDirectory({ - super.key, - }); - - @override - State createState() => _MzansiDirectoryState(); -} - -class _MzansiDirectoryState extends State { - bool _isLoadingInitialData = true; - late Future futurePosition = - MIHLocationAPI().getGPSPosition(context); - late final MihSearchMzansi _searchTool; - late final MihFavouriteBusinesses _favouritesTool; - - Future _loadInitialData() async { - setState(() { - _isLoadingInitialData = true; - }); - MzansiProfileProvider mzansiProfileProvider = - context.read(); - if (mzansiProfileProvider.user == null) { - await MihDataHelperServices().loadUserDataOnly( - mzansiProfileProvider, - ); - } - setState(() { - _isLoadingInitialData = false; - }); - initialiseGPSLocation(); - } - - Future initialiseGPSLocation() async { - MzansiDirectoryProvider directoryProvider = - context.read(); - Position? userPos = await MIHLocationAPI().getGPSPosition(context); - directoryProvider.setUserPosition(userPos); - } - - @override - void initState() { - super.initState(); - _searchTool = const MihSearchMzansi(); - _favouritesTool = const MihFavouriteBusinesses(); - _loadInitialData(); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, MzansiDirectoryProvider directoryProvider, - Widget? child) { - if (_isLoadingInitialData) { - return Scaffold( - body: Center( - child: Mihloadingcircle(), - ), - ); - } - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: getToolTitle(), - selectedbodyIndex: directoryProvider.toolIndex, - onIndexChange: (newValue) { - directoryProvider.setToolIndex(newValue); - }, - ); - }, - ); - } - - List getToolBody() { - return [ - _searchTool, - _favouritesTool, - ]; - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - MzansiDirectoryProvider directoryProvider = - context.read(); - context.goNamed( - 'mihHome', - ); - directoryProvider.setToolIndex(0); - directoryProvider.setPersonalSearch(true); - FocusScope.of(context).unfocus(); - }, - ); - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.search)] = () { - context.read().setToolIndex(0); - }; - temp[const Icon(Icons.business_center)] = () { - context.read().setToolIndex(1); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: context.watch().toolIndex, - ); - } - - List getToolTitle() { - List toolTitles = [ - "Mzansi Search", - "Favourite Businesses", - // "Contacts", - ]; - return toolTitles; - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_directory/package_tiles/mzansi_directory_tile.dart b/mih_ui/lib/mih_packages/mzansi_directory/package_tiles/mzansi_directory_tile.dart deleted file mode 100644 index aeb5b6f4..00000000 --- a/mih_ui/lib/mih_packages/mzansi_directory/package_tiles/mzansi_directory_tile.dart +++ /dev/null @@ -1,47 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MzansiDirectoryTile extends StatefulWidget { - final double packageSize; - const MzansiDirectoryTile({ - super.key, - required this.packageSize, - }); - - @override - State createState() => _MzansiDirectoryTileState(); -} - -class _MzansiDirectoryTileState extends State { - @override - Widget build(BuildContext context) { - return MihPackageTile( - onTap: () { - context.goNamed( - "mzansiDirectory", - ); - // Navigator.of(context).pushNamed( - // '/mzansi-directory', - // arguments: MzansiDirectoryArguments( - // personalSearch: true, - // startSearchText: null, - // ), - // ); - }, - appName: "Mzansi Directory", - appIcon: Icon( - MihIcons.mzansiDirectory, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // size: widget.packageSize, - ), - iconSize: widget.packageSize, - textColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_directory/package_tools/mih_contacts.dart b/mih_ui/lib/mih_packages/mzansi_directory/package_tools/mih_contacts.dart deleted file mode 100644 index 4814d109..00000000 --- a/mih_ui/lib/mih_packages/mzansi_directory/package_tools/mih_contacts.dart +++ /dev/null @@ -1,53 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihContacts extends StatefulWidget { - const MihContacts({super.key}); - - @override - State createState() => _MihContactsState(); -} - -class _MihContactsState extends State { - final TextEditingController contactSearchController = TextEditingController(); - final FocusNode searchFocusNode = FocusNode(); - - @override - Widget build(BuildContext context) { - final Size size = MediaQuery.sizeOf(context); - final double width = size.width; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(width), - ); - } - - Widget getBody(double width) { - return MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: MihSearchBar( - controller: contactSearchController, - hintText: "Search Contacts", - prefixIcon: Icons.search, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - hintColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onPrefixIconTap: () {}, - searchFocusNode: searchFocusNode, - ), - ), - const SizedBox(height: 10), - ], - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_directory/package_tools/mih_favourite_businesses.dart b/mih_ui/lib/mih_packages/mzansi_directory/package_tools/mih_favourite_businesses.dart deleted file mode 100644 index cff989f5..00000000 --- a/mih_ui/lib/mih_packages/mzansi_directory/package_tools/mih_favourite_businesses.dart +++ /dev/null @@ -1,242 +0,0 @@ -import 'dart:async'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/builders/build_favourite_businesses_list.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart'; -import 'package:provider/provider.dart'; - -class MihFavouriteBusinesses extends StatefulWidget { - const MihFavouriteBusinesses({ - super.key, - }); - - @override - State createState() => _MihFavouriteBusinessesState(); -} - -class _MihFavouriteBusinessesState extends State { - final TextEditingController businessSearchController = - TextEditingController(); - final FocusNode searchFocusNode = FocusNode(); - final ValueNotifier> searchBookmarkedBusinesses = - ValueNotifier([]); - Timer? _debounce; - - Future getFavouriteBusinesses( - MzansiDirectoryProvider directoryProvider) async { - MzansiProfileProvider profileProvider = - context.read(); - if (directoryProvider.bookmarkedBusinesses.isEmpty) { - await MihMzansiDirectoryServices().getAllUserBookmarkedBusiness( - profileProvider.user!.app_id, - directoryProvider, - ); - List favBus = []; - Map> favBusImages = {}; - Future businessLogoUrl; - for (var bus in directoryProvider.bookmarkedBusinesses) { - await MihBusinessDetailsServices() - .getBusinessDetailsByBusinessId(bus.business_id) - .then((business) async { - favBus.add(business!); - businessLogoUrl = MihFileApi.getMinioFileUrl(business.logo_path); - favBusImages[business.business_id] = businessLogoUrl; - }); - } - directoryProvider.setFavouriteBusinesses( - businesses: favBus, - businessesImagesUrl: favBusImages, - ); - } - } - - void _filterAndSetBusinesses(MzansiDirectoryProvider directoryProvider) { - List businessesToDisplay = []; - String query = businessSearchController.text.toLowerCase(); - if (directoryProvider.favouriteBusinessesList != null) { - for (var bus in directoryProvider.favouriteBusinessesList!) { - if (bus.Name.toLowerCase().contains(query)) { - businessesToDisplay.add(bus); - } - } - } - searchBookmarkedBusinesses.value = businessesToDisplay; - } - - @override - void dispose() { - super.dispose(); - businessSearchController.dispose(); - searchFocusNode.dispose(); - searchBookmarkedBusinesses.dispose(); - } - - @override - void initState() { - super.initState(); - MzansiDirectoryProvider directoryProvider = - context.read(); - // getAndMapAllBusinessDetailsForBookmarkedBusinesses( - // mzansiProfileProvider, - // directoryProvider, - // ); - getFavouriteBusinesses(directoryProvider); - _filterAndSetBusinesses(directoryProvider); - businessSearchController.addListener(() { - if (_debounce?.isActive ?? false) { - _debounce!.cancel(); - } - _debounce = Timer(const Duration(milliseconds: 200), () { - _filterAndSetBusinesses(directoryProvider); - }); - }); - } - - @override - Widget build(BuildContext context) { - final Size size = MediaQuery.sizeOf(context); - final double width = size.width; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(width), - ); - } - - Widget getBody(double width) { - return Consumer( - builder: (BuildContext context, MzansiDirectoryProvider directoryProvider, - Widget? child) { - _filterAndSetBusinesses(directoryProvider); - if (directoryProvider.favouriteBusinessesList == null) { - return Center( - child: Mihloadingcircle(), - ); - } - return Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: MihSearchBar( - controller: businessSearchController, - hintText: "Search Businesses", - prefixIcon: Icons.search, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - hintColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onPrefixIconTap: () {}, - searchFocusNode: searchFocusNode, - ), - ), - const SizedBox(height: 10), - Expanded( - child: ValueListenableBuilder>( - valueListenable: searchBookmarkedBusinesses, - builder: (context, filteredBusinesses, child) { - if (filteredBusinesses.isEmpty && - businessSearchController.text.isNotEmpty) { - return Column( - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.iDontKnow, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - const SizedBox(height: 10), - Text( - "Let's try refining your search", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ], - ); - } else if (filteredBusinesses.isEmpty && - businessSearchController.text.isEmpty) { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.businessProfile, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - const SizedBox(height: 10), - Text( - "No favourite businesses added to your mzansi directory", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - children: [ - TextSpan(text: "Use the mzansi search"), - TextSpan( - text: - " to find your favourite businesses of mzansi"), - ], - ), - ), - ), - ], - ), - ); - } - // KenLogger.success(filteredBusinesses); - return BuildFavouriteBusinessesList( - favouriteBusinesses: filteredBusinesses, - ); - }), - ), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_directory/package_tools/mih_search_mzansi.dart b/mih_ui/lib/mih_packages/mzansi_directory/package_tools/mih_search_mzansi.dart deleted file mode 100644 index 2fa17e2b..00000000 --- a/mih_ui/lib/mih_packages/mzansi_directory/package_tools/mih_search_mzansi.dart +++ /dev/null @@ -1,577 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/builders/build_business_search_resultsList.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/builders/build_user_search_results_list.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart'; -import 'package:provider/provider.dart'; - -class MihSearchMzansi extends StatefulWidget { - const MihSearchMzansi({ - super.key, - }); - - @override - State createState() => _MihSearchMzansiState(); -} - -class _MihSearchMzansiState extends State { - final TextEditingController mzansiSearchController = TextEditingController(); - final TextEditingController businessTypeController = TextEditingController(); - final FocusNode searchFocusNode = FocusNode(); - // late bool userSearch; - // Future?> futureUserSearchResults = Future.value(); - List userSearchResults = []; - List businessSearchResults = []; - late Future> availableBusinessTypes; - bool filterOn = false; - bool loadingSearchResults = false; - - Future swapPressed(MzansiProfileProvider profileProvider, - MzansiDirectoryProvider directoryProvider) async { - directoryProvider.setPersonalSearch(!directoryProvider.personalSearch); - setState(() { - if (filterOn) { - filterOn = !filterOn; - } - }); - if (businessTypeController.text.isNotEmpty) { - setState(() { - businessTypeController.clear(); - }); - } - await searchPressed(profileProvider, directoryProvider); - } - - void clearAll(MzansiDirectoryProvider directoryProvider) { - directoryProvider - .setSearchedBusinesses(searchedBusinesses: [], businessesImagesUrl: {}); - directoryProvider.setSearchedUsers(searchedUsers: [], userImagesUrl: {}); - directoryProvider.setSearchTerm(searchTerm: ""); - setState(() { - mzansiSearchController.clear(); - businessTypeController.clear(); - }); - } - - Future searchPressed(MzansiProfileProvider profileProvider, - MzansiDirectoryProvider directoryProvider) async { - setState(() { - loadingSearchResults = true; - }); - directoryProvider.setSearchTerm(searchTerm: mzansiSearchController.text); - directoryProvider.setBusinessTypeFilter( - businessTypeFilter: businessTypeController.text); - if (directoryProvider.personalSearch && - directoryProvider.searchTerm.isNotEmpty) { - final userResults = await MihUserServices() - .searchUsers(profileProvider, directoryProvider.searchTerm, context); - Map> userImages = {}; - Future usernProPicUrl; - for (var user in userResults) { - KenLogger.success("Business Logo Path: ${user.pro_pic_path}"); - usernProPicUrl = MihFileApi.getMinioFileUrl(user.pro_pic_path); - KenLogger.success("Business Logo Path: ${user.pro_pic_path}"); - userImages[user.app_id] = usernProPicUrl; - // != "" - // ? CachedNetworkImageProvider(usernProPicUrl) - // : null; - } - - directoryProvider.setSearchedUsers( - searchedUsers: userResults, - userImagesUrl: userImages, - ); - } else { - List? businessSearchResults = []; - if (directoryProvider.businessTypeFilter.isNotEmpty) { - businessSearchResults = await MihBusinessDetailsServices() - .searchBusinesses(directoryProvider.searchTerm, - directoryProvider.businessTypeFilter, context); - } else if (directoryProvider.searchTerm.isNotEmpty) { - businessSearchResults = await MihBusinessDetailsServices() - .searchBusinesses(directoryProvider.searchTerm, - directoryProvider.businessTypeFilter, context); - } - Map> busImagesUrl = {}; - Future businessLogoUrl; - for (var bus in businessSearchResults) { - KenLogger.success("Business Logo Path: ${bus.logo_path}"); - businessLogoUrl = MihFileApi.getMinioFileUrl(bus.logo_path); - KenLogger.success("Business Logo Path: ${bus.logo_path}"); - busImagesUrl[bus.business_id] = businessLogoUrl; - // != "" - // ? CachedNetworkImageProvider(businessLogoUrl) - // : null; - } - directoryProvider.setSearchedBusinesses( - searchedBusinesses: businessSearchResults, - businessesImagesUrl: busImagesUrl, - ); - } - setState(() { - loadingSearchResults = false; - }); - } - - @override - void dispose() { - super.dispose(); - businessTypeController.dispose(); - mzansiSearchController.dispose(); - } - - @override - void initState() { - super.initState(); - MzansiDirectoryProvider directoryProvider = - context.read(); - availableBusinessTypes = - MihBusinessDetailsServices().fetchAllBusinessTypes(); - mzansiSearchController.text = directoryProvider.searchTerm; - } - - @override - Widget build(BuildContext context) { - final Size size = MediaQuery.sizeOf(context); - final double width = size.width; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(width), - ); - } - - Widget getBody(double width) { - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - MzansiDirectoryProvider directoryProvider, Widget? child) { - return Column( - children: [ - Text( - directoryProvider.personalSearch - ? "People Search" - : "Businesses Search", - style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), - ), - const SizedBox(height: 10), - Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: MihSearchBar( - controller: mzansiSearchController, - hintText: "Search Mzansi", - prefixIcon: Icons.search, - prefixAltIcon: directoryProvider.personalSearch - ? Icons.person - : Icons.business, - suffixTools: [ - IconButton( - onPressed: () { - swapPressed(profileProvider, directoryProvider); - }, - icon: Icon( - Icons.swap_horiz_rounded, - size: 35, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ], - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - hintColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onPrefixIconTap: () { - searchPressed(profileProvider, directoryProvider); - }, - onClearIconTap: () { - clearAll(directoryProvider); - }, - searchFocusNode: searchFocusNode, - ), - ), - Visibility( - visible: !directoryProvider.personalSearch, - child: const SizedBox(width: 10), - ), - Visibility( - visible: !directoryProvider.personalSearch, - child: IconButton( - onPressed: () { - if (filterOn) { - clearAll(directoryProvider); - } - setState(() { - filterOn = !filterOn; - }); - }, - icon: Icon( - !filterOn - ? Icons.filter_list_rounded - : Icons.filter_list_off_rounded, - size: 35, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - ], - ), - ), - const SizedBox(height: 10), - FutureBuilder( - future: availableBusinessTypes, - builder: (context, asyncSnapshot) { - List options = []; - if (asyncSnapshot.connectionState == ConnectionState.done) { - options.addAll(asyncSnapshot.data!); - } - return Visibility( - visible: filterOn, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Expanded( - child: MihDropdownField( - controller: businessTypeController, - hintText: "Business Type", - dropdownOptions: options, - requiredText: true, - editable: true, - enableSearch: true, - ), - ), - const SizedBox(width: 10), - MihButton( - onPressed: () { - if (businessTypeController.text.isNotEmpty) { - searchPressed( - profileProvider, directoryProvider); - } else { - MihAlertServices().errorBasicAlert( - "Business Type Not Selected", - "Please ensure you have selected a Business Type before seareching for Businesses of Mzansi", - context, - ); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - elevation: 10, - child: Text( - "Search", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ); - }), - const SizedBox(height: 10), - Expanded( - child: directoryProvider.personalSearch - ? displayPersonalSearchResults(directoryProvider) - : displayBusinessSearchResults(directoryProvider), - ), - ], - ); - }, - ); - } - - Widget displayBusinessSearchResults( - MzansiDirectoryProvider directoryProvider) { - if (loadingSearchResults) { - return Center( - child: const Mihloadingcircle(), - ); - } else if (directoryProvider.searchedBusinesses.isNotEmpty) { - // return Text("Pulled Data successfully"); - directoryProvider.searchedBusinesses - .sort((a, b) => a.Name.compareTo(b.Name)); - return BuildBusinessSearchResultsList( - businessList: directoryProvider.searchedBusinesses, - ); - } else if (directoryProvider.searchedBusinesses.isEmpty && - directoryProvider.searchTerm.isNotEmpty) { - return MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.iDontKnow, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 25), - Text( - "Let's try refining your search", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ], - ), - ); - } else if (directoryProvider.searchedBusinesses.isEmpty && - directoryProvider.searchTerm.isEmpty) { - return MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.businessProfile, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "Search for businesses of Mzansi!", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - Icons.swap_horiz_rounded, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - TextSpan(text: " to search for people of Mzansi"), - ], - ), - ), - ), - const SizedBox(height: 10), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - Icons.filter_list_rounded, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - TextSpan(text: " to filter business types"), - ], - ), - ), - ), - ], - ), - ), - ); - } else { - return Center( - child: Text( - "Error pulling Patients Data\n/users/search/${directoryProvider.searchTerm}", - style: TextStyle( - fontSize: 25, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark")), - textAlign: TextAlign.center, - ), - ); - } - } - - Widget displayPersonalSearchResults( - MzansiDirectoryProvider directoryProvider) { - if (loadingSearchResults) { - return Center( - child: const Mihloadingcircle(), - ); - } else if (directoryProvider.searchedUsers.isNotEmpty) { - directoryProvider.searchedUsers - .sort((a, b) => a.username.compareTo(b.username)); - return BuildUserSearchResultsList( - userList: directoryProvider.searchedUsers); - } else if (directoryProvider.searchedUsers.isEmpty && - directoryProvider.searchTerm.isEmpty) { - return MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.personalProfile, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "Search for people of Mzansi!", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - Icons.swap_horiz_rounded, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - TextSpan(text: " to search for businesses of Mzansi"), - ], - ), - ), - ), - ], - ), - ), - ); - } else if (directoryProvider.searchedUsers.isEmpty && - directoryProvider.searchTerm.isNotEmpty) { - return MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.iDontKnow, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "Let's try refining your search", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ], - ), - ); - } else { - return Center( - child: Text( - "Error pulling Patients Data\n/users/search/${directoryProvider.searchTerm}", - style: TextStyle( - fontSize: 25, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark")), - textAlign: TextAlign.center, - ), - ); - } - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/builders/build_employee_list.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/builders/build_employee_list.dart deleted file mode 100644 index b15b6d4f..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/builders/build_employee_list.dart +++ /dev/null @@ -1,74 +0,0 @@ -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business_employee.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_edit_employee_details_window.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class BuildEmployeeList extends StatefulWidget { - const BuildEmployeeList({ - super.key, - }); - - @override - State createState() => _BuildEmployeeListState(); -} - -class _BuildEmployeeListState extends State { - final baseAPI = AppEnviroment.baseApiUrl; - - void updateEmployeePopUp(BusinessEmployee employee) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihEditEmployeeDetailsWindow( - employee: employee, - ), - ); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - return ListView.separated( - separatorBuilder: (BuildContext context, index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemCount: mzansiProfileProvider.employeeList!.length, - itemBuilder: (context, index) { - //final patient = widget.patients[index].id_no.contains(widget.searchString); - //print(index); - BusinessEmployee employee = - mzansiProfileProvider.employeeList![index]; - String isMe = ""; - if (mzansiProfileProvider.user!.app_id == - mzansiProfileProvider.employeeList![index].app_id) { - isMe = "(You)"; - } - return ListTile( - title: Text( - "${mzansiProfileProvider.employeeList![index].fname} ${mzansiProfileProvider.employeeList![index].lname} - ${mzansiProfileProvider.employeeList![index].title} $isMe"), - subtitle: Text( - "${mzansiProfileProvider.employeeList![index].username}\n${mzansiProfileProvider.employeeList![index].email}\nAccess: ${mzansiProfileProvider.employeeList![index].access}", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - onTap: () { - updateEmployeePopUp(employee); - }, - ); - }, - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/builders/build_user_list.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/builders/build_user_list.dart deleted file mode 100644 index 73e5ecea..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/builders/build_user_list.dart +++ /dev/null @@ -1,77 +0,0 @@ -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_add_employee_window.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class BuildUserList extends StatefulWidget { - const BuildUserList({ - super.key, - }); - - @override - State createState() => _BuildUserListState(); -} - -class _BuildUserListState extends State { - final baseAPI = AppEnviroment.baseApiUrl; - - String hideEmail(String email) { - var firstLetter = email[0]; - var end = email.split("@")[1]; - return "$firstLetter********@$end"; - } - - void addEmployeePopUp( - MzansiProfileProvider profileProvider, int index, double width) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihAddEmployeeWindow( - user: profileProvider.userSearchResults[index], - ), - ); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return Consumer( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - Widget? child) { - return ListView.separated( - separatorBuilder: (BuildContext context, index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemCount: profileProvider.userSearchResults.length, - itemBuilder: (context, index) { - var isYou = ""; - if (profileProvider.user!.app_id == - profileProvider.userSearchResults[index].app_id) { - isYou = "(You)"; - } - return ListTile( - title: Text( - "@${profileProvider.userSearchResults[index].username} $isYou"), - subtitle: Text( - "Email: ${hideEmail(profileProvider.userSearchResults[index].email)}", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - onTap: () { - addEmployeePopUp(profileProvider, index, screenWidth); - }, - ); - }, - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/busines_profile.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/busines_profile.dart deleted file mode 100644 index 36510f89..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/busines_profile.dart +++ /dev/null @@ -1,158 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_qr_code.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_reviews.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_user_search.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_my_business_team.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_my_business_user.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_business_employee_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_data_helper_services.dart'; -import 'package:provider/provider.dart'; - -class BusinesProfile extends StatefulWidget { - const BusinesProfile({super.key}); - - @override - State createState() => _BusinesProfileState(); -} - -class _BusinesProfileState extends State { - bool _isLoadingInitialData = true; - late final MihBusinessDetails _businessDetails; - late final MihMyBusinessUser _businessUser; - late final MihMyBusinessTeam _businessTeam; - late final MihBusinessUserSearch _businessUserSearch; - late final MihBusinessReviews _businessReviews; - late final MihBusinessQrCode _businessQrCode; - - Future _loadInitialData() async { - setState(() { - _isLoadingInitialData = true; - }); - MzansiProfileProvider mzansiProfileProvider = - context.read(); - if (mzansiProfileProvider.user == null) { - await MihDataHelperServices().loadUserDataWithBusinessesData( - mzansiProfileProvider, - ); - } - await MihBusinessEmployeeServices() - .fetchEmployees(mzansiProfileProvider, context); - setState(() { - _isLoadingInitialData = false; - }); - } - - @override - void initState() { - super.initState(); - _businessDetails = MihBusinessDetails(); - _businessUser = MihMyBusinessUser(); - _businessTeam = MihMyBusinessTeam(); - _businessUserSearch = MihBusinessUserSearch(); - _businessReviews = MihBusinessReviews(business: null); - _businessQrCode = MihBusinessQrCode(business: null); - _loadInitialData(); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - if (_isLoadingInitialData) { - return Scaffold( - body: Center( - child: Mihloadingcircle(), - ), - ); - } - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appToolTitles: getToolTitle(), - appBody: getToolBody(), - selectedbodyIndex: mzansiProfileProvider.businessIndex, - onIndexChange: (newIndex) { - mzansiProfileProvider.setBusinessIndex(newIndex); - }, - ); - }, - ); - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - MzansiProfileProvider mzansiProfileProvider = - context.read(); - context.goNamed( - 'mihHome', - ); - mzansiProfileProvider.setHideBusinessUserDetails(true); - mzansiProfileProvider.setBusinessIndex(0); - FocusScope.of(context).unfocus(); - }, - ); - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.business)] = () { - context.read().setBusinessIndex(0); - }; - temp[const Icon(Icons.person)] = () { - context.read().setBusinessIndex(1); - }; - temp[const Icon(Icons.people)] = () { - context.read().setBusinessIndex(2); - }; - temp[const Icon(Icons.add)] = () { - context - .read() - .setUserearchResults(userSearchResults: []); - context.read().setBusinessIndex(3); - }; - temp[const Icon(Icons.star_rate_rounded)] = () { - context.read().setBusinessIndex(4); - }; - temp[const Icon(Icons.qr_code_rounded)] = () { - context.read().setBusinessIndex(5); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: context.watch().businessIndex, - ); - } - - List getToolTitle() { - List toolTitles = [ - "Profile", - "User", - "Team", - "Add", - "Reviews", - "Share", - ]; - return toolTitles; - } - - List getToolBody() { - return [ - _businessDetails, - _businessUser, - _businessTeam, - _businessUserSearch, - _businessReviews, - _businessQrCode, - ]; - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_add_bookmark_alert.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_add_bookmark_alert.dart deleted file mode 100644 index cee5eb0c..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_add_bookmark_alert.dart +++ /dev/null @@ -1,206 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart'; -import 'package:provider/provider.dart'; - -class MihAddBookmarkAlert extends StatefulWidget { - final Business business; - final void Function()? onSuccessDismissPressed; - const MihAddBookmarkAlert({ - super.key, - required this.business, - required this.onSuccessDismissPressed, - }); - - @override - State createState() => _MihAddBookmarkAlertState(); -} - -class _MihAddBookmarkAlertState extends State { - Future getFavouriteBusinesses() async { - MzansiDirectoryProvider directoryProvider = - context.read(); - MzansiProfileProvider profileProvider = - context.read(); - await MihMzansiDirectoryServices().getAllUserBookmarkedBusiness( - profileProvider.user!.app_id, - directoryProvider, - ); - List favBus = []; - Map> favBusImages = {}; - Future businessLogoUrl; - for (var bus in directoryProvider.bookmarkedBusinesses) { - await MihBusinessDetailsServices() - .getBusinessDetailsByBusinessId(bus.business_id) - .then((business) async { - favBus.add(business!); - businessLogoUrl = MihFileApi.getMinioFileUrl(business.logo_path); - favBusImages[business.business_id] = businessLogoUrl; - }); - } - directoryProvider.setFavouriteBusinesses( - businesses: favBus, - businessesImagesUrl: favBusImages, - ); - } - - Future addBookmark( - MzansiProfileProvider profileProvider, String business_id) async { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - await MihMzansiDirectoryServices() - .addBookmarkedBusiness(profileProvider.user!.app_id, business_id) - .then((statusCode) { - context.pop(); - if (statusCode == 201) { - successPopUp( - "Successfully Bookmarked Business!", - "${widget.business.Name} has successfully been added to favourite businessess in the Mzansi Directory.", - ); - } else { - MihAlertServices().errorBasicAlert( - "Error Adding Bookmark", - "An error occured while add ${widget.business.Name} to you Mzansi Directory, Please try again later.", - context, - ); - } - }); - } - - void successPopUp(String title, String message) { - MihAlertServices().successAdvancedAlert( - title, - message, - [ - MihButton( - onPressed: () async { - await getFavouriteBusinesses(); - widget.onSuccessDismissPressed!.call(); - context.pop(); - context.pop(); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - Widget? child) { - return MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - windowBody: Column( - children: [ - Icon( - Icons.warning_rounded, - size: 150, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Text( - "Bookmark Business", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - Text( - "Are you sure you want to save ${widget.business.Name} to your Mzansi Directory?", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 18, - ), - ), - const SizedBox(height: 25), - Wrap( - runAlignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - alignment: WrapAlignment.center, - spacing: 10, - runSpacing: 10, - children: [ - MihButton( - width: 300, - onPressed: () async { - Navigator.of(context).pop(); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Text( - "Cancel", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - width: 300, - onPressed: () { - addBookmark(profileProvider, widget.business.business_id); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Text( - "Bookmark Business", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ], - ), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_add_employee_window.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_add_employee_window.dart deleted file mode 100644 index b0f7e02d..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_add_employee_window.dart +++ /dev/null @@ -1,203 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_business_employee_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:provider/provider.dart'; - -class MihAddEmployeeWindow extends StatefulWidget { - final AppUser user; - const MihAddEmployeeWindow({ - super.key, - required this.user, - }); - - @override - State createState() => _MihAddEmployeeWindowState(); -} - -class _MihAddEmployeeWindowState extends State { - TextEditingController accessController = TextEditingController(); - TextEditingController usernameController = TextEditingController(); - TextEditingController emailController = TextEditingController(); - final _formKey = GlobalKey(); - - Future createBusinessUserAPICall( - MzansiProfileProvider mzansiProfileProvider) async { - int statusCode = await MihBusinessEmployeeServices().addEmployee( - mzansiProfileProvider, - widget.user, - accessController.text, - context, - ); - if (statusCode == 201) { - String message = - "${widget.user.username} is now apart of your team with ${accessController.text} access to ${mzansiProfileProvider.business!.Name}"; - successPopUp(message, false); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - void successPopUp(String message, bool stayOnPersonalSide) { - MihAlertServices().successAdvancedAlert( - "Successfully Added Employee", - message, - [ - MihButton( - onPressed: () { - context.pop(); - context.pop(); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ) - ], - context, - ); - } - - bool isRequiredFieldsCaptured() { - if (accessController.text.isEmpty) { - return false; - } else { - return true; - } - } - - @override - void dispose() { - super.dispose(); - accessController.dispose(); - usernameController.dispose(); - emailController.dispose(); - } - - @override - void initState() { - super.initState(); - usernameController.text = widget.user.username; - emailController.text = widget.user.email; - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - return MihPackageWindow( - fullscreen: false, - windowTitle: "Add Employee", - windowBody: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: screenWidth * 0.05) - : const EdgeInsets.symmetric(horizontal: 0), - child: Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: usernameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Username", - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: emailController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Email", - ), - const SizedBox(height: 10.0), - MihDropdownField( - controller: accessController, - hintText: "Access Type", - dropdownOptions: const ["Full", "Partial"], - editable: true, - enableSearch: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - requiredText: true, - ), - const SizedBox(height: 15.0), - Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - if (isRequiredFieldsCaptured()) { - createBusinessUserAPICall(mzansiProfileProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Add", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ], - ), - ), - onWindowTapClose: () { - Navigator.pop(context); - }, - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_delete_bookmark_alert.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_delete_bookmark_alert.dart deleted file mode 100644 index e2c7f100..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_delete_bookmark_alert.dart +++ /dev/null @@ -1,205 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/bookmarked_business.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart'; -import 'package:provider/provider.dart'; - -class MihDeleteBookmarkAlert extends StatefulWidget { - final Business business; - final BookmarkedBusiness? bookmarkBusiness; - final void Function()? onSuccessDismissPressed; - // final String? startUpSearch; - const MihDeleteBookmarkAlert({ - super.key, - required this.business, - required this.bookmarkBusiness, - required this.onSuccessDismissPressed, - // required this.startUpSearch, - }); - - @override - State createState() => _MihDeleteBookmarkAlertState(); -} - -class _MihDeleteBookmarkAlertState extends State { - Future getFavouriteBusinesses() async { - MzansiDirectoryProvider directoryProvider = - context.read(); - MzansiProfileProvider profileProvider = - context.read(); - await MihMzansiDirectoryServices().getAllUserBookmarkedBusiness( - profileProvider.user!.app_id, - directoryProvider, - ); - List favBus = []; - Map> favBusImages = {}; - Future businessLogoUrl; - for (var bus in directoryProvider.bookmarkedBusinesses) { - await MihBusinessDetailsServices() - .getBusinessDetailsByBusinessId(bus.business_id) - .then((business) async { - favBus.add(business!); - businessLogoUrl = MihFileApi.getMinioFileUrl(business.logo_path); - favBusImages[business.business_id] = businessLogoUrl; - }); - } - directoryProvider.setFavouriteBusinesses( - businesses: favBus, - businessesImagesUrl: favBusImages, - ); - } - - Future deleteBookmark(int idbookmarked_businesses) async { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - await MihMzansiDirectoryServices() - .deleteBookmarkedBusiness(idbookmarked_businesses) - .then((statusCode) { - context.pop(); - if (statusCode == 200) { - successPopUp( - "Successfully Removed Bookmark!", - "${widget.business.Name} has successfully been removed your favourite businessess in the Mzansi Directory.", - ); - } else { - MihAlertServices().errorBasicAlert( - "Error Adding Bookmark", - "An error occured while add ${widget.business.Name} to you Mzansi Directory, Please try again later.", - context, - ); - } - }); - } - - void successPopUp(String title, String message) { - MihAlertServices().successAdvancedAlert( - title, - message, - [ - MihButton( - onPressed: () async { - await getFavouriteBusinesses(); - widget.onSuccessDismissPressed!.call(); - context.pop(); - context.pop(); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ) - ], - context, - ); - } - - @override - Widget build(BuildContext context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - windowBody: Column( - children: [ - Icon( - Icons.warning_rounded, - size: 150, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Text( - "Remove Bookmark", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - Text( - "Are you sure you want to remove ${widget.business.Name} from your Mzansi Directory?", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 18, - ), - ), - const SizedBox(height: 25), - Wrap( - runAlignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - alignment: WrapAlignment.center, - spacing: 10, - runSpacing: 10, - children: [ - MihButton( - width: 300, - onPressed: () async { - Navigator.of(context).pop(); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Text( - "Cancel", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - width: 300, - onPressed: () { - // todo: remove bookmark - deleteBookmark( - widget.bookmarkBusiness!.idbookmarked_businesses); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Text( - "Remove Business", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ], - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_edit_employee_details_window.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_edit_employee_details_window.dart deleted file mode 100644 index fe454a62..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_edit_employee_details_window.dart +++ /dev/null @@ -1,271 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business_employee.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_business_employee_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:provider/provider.dart'; - -class MihEditEmployeeDetailsWindow extends StatefulWidget { - final BusinessEmployee employee; - const MihEditEmployeeDetailsWindow({ - super.key, - required this.employee, - }); - - @override - State createState() => - _MihEditEmployeeDetailsWindowState(); -} - -class _MihEditEmployeeDetailsWindowState - extends State { - TextEditingController accessController = TextEditingController(); - TextEditingController titleController = TextEditingController(); - TextEditingController fnameController = TextEditingController(); - TextEditingController lnameController = TextEditingController(); - final _formKey = GlobalKey(); - - void updateEmployeeAPICall( - MzansiProfileProvider mzansiProfileProvider) async { - int statusCode = await MihBusinessEmployeeServices().updateEmployeeDetails( - mzansiProfileProvider, - widget.employee, - titleController.text, - accessController.text, - context); - if (statusCode == 200) { - String message = "Your employees details have been updated."; - successPopUp(message, false); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - Future deleteEmployeeApiCall() async { - int statusCode = await MihBusinessEmployeeServices().deleteEmployee( - context.read(), - widget.employee, - context, - ); - if (statusCode == 200) { - String message = - "The employee has been deleted successfully. This means they will no longer have access to your business profile"; - context.pop(); - successPopUp(message, false); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - void showDeleteWarning() { - MihAlertServices().deleteConfirmationAlert( - "This team member will be deleted permanently from the business profile. Are you certain you want to delete it?", - () { - deleteEmployeeApiCall(); - }, - context, - ); - } - - void successPopUp(String message, bool stayOnPersonalSide) { - MihAlertServices().successAdvancedAlert( - "Successfully Updated Employee Details", - message, - [ - MihButton( - onPressed: () { - context.pop(); - context.pop(); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - bool isRequiredFieldsCaptured() { - if (accessController.text.isEmpty || titleController.text.isEmpty) { - return false; - } else { - return true; - } - } - - @override - void dispose() { - accessController.dispose(); - titleController.dispose(); - fnameController.dispose(); - lnameController.dispose(); - super.dispose(); - } - - @override - void initState() { - super.initState(); - fnameController.text = widget.employee.fname; - lnameController.text = widget.employee.lname; - titleController.text = widget.employee.title; - accessController.text = widget.employee.access; - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - return MihPackageWindow( - fullscreen: false, - windowTitle: "Employee Details", - menuOptions: [ - SpeedDialChild( - child: Icon( - Icons.delete, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Delete Employee", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - showDeleteWarning(); - }, - ), - ], - onWindowTapClose: () { - Navigator.pop(context); - }, - windowBody: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: screenWidth * 0.05) - : const EdgeInsets.symmetric(horizontal: 0), - child: Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: fnameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "First Name", - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: lnameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Surname", - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: titleController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Title", - ), - const SizedBox(height: 10.0), - MihDropdownField( - controller: accessController, - hintText: "Access Type", - dropdownOptions: const ["Full", "Partial"], - editable: true, - enableSearch: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - requiredText: true, - ), - const SizedBox(height: 20.0), - Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - if (isRequiredFieldsCaptured()) { - updateEmployeeAPICall(mzansiProfileProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Update", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ], - ), - ), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart deleted file mode 100644 index 4b1d22cd..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart +++ /dev/null @@ -1,551 +0,0 @@ -import 'package:custom_rating_bar/custom_rating_bar.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business_review.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:provider/provider.dart'; - -class MihReviewBusinessWindow extends StatefulWidget { - final Business business; - final BusinessReview? businessReview; - final double screenWidth; - final bool readOnly; - final void Function()? onSuccessDismissPressed; - const MihReviewBusinessWindow({ - super.key, - required this.business, - required this.businessReview, - required this.screenWidth, - required this.readOnly, - required this.onSuccessDismissPressed, - }); - - @override - State createState() => - _MihReviewBusinessWindowState(); -} - -class _MihReviewBusinessWindowState extends State { - final _formKey = GlobalKey(); - final TextEditingController _reviewTitleController = TextEditingController(); - final TextEditingController _reviewScoreController = TextEditingController(); - final TextEditingController _reviewReviewerController = - TextEditingController(); - final TextEditingController _reviewDescriptionController = - TextEditingController(); - late final VoidCallback _reviewDescriptionListener; - final ValueNotifier _counter = ValueNotifier(0); - - void showDeleteReviewAlert(MzansiDirectoryProvider directoryProvider) { - MihAlertServices().errorAdvancedAlert( - "Delete Review", - "Are you sure you want to delete this review? This action cannot be undone.", - [ - MihButton( - width: 300, - onPressed: () async { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - await MihMzansiDirectoryServices() - .deleteBusinessReview( - widget.businessReview!.idbusiness_ratings, - widget.businessReview!.business_id, - widget.businessReview!.rating_score, - widget.business.rating, - ) - .then((statusCode) async { - context.pop(); //Remove loading dialog - context.pop(); //Remove delete dialog - if (statusCode == 200) { - await refreshBusiness(directoryProvider); - successPopUp( - "Successfully Deleted Review!", - "Your review has successfully been delete and will no longer appear under the business.", - ); - } else { - MihAlertServices().errorBasicAlert( - "Error Deleting Review", - "There was an error deleting your review. Please try again later.", - context, - ); - } - }); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Text( - "Delete", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - width: 300, - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Text( - "Cancel", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - Color getMissionVisionLimitColor(int limit) { - if (_counter.value <= limit) { - return MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } else { - return MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } - } - - Future refreshBusiness( - MzansiDirectoryProvider directoryProvider) async { - Business? refresedBusiness = await MihBusinessDetailsServices() - .getBusinessDetailsByBusinessId(widget.business.business_id); - if (refresedBusiness != null) { - directoryProvider.setSelectedBusiness(business: refresedBusiness); - } - } - - void submitForm( - MzansiProfileProvider profileProvider, - MzansiDirectoryProvider directoryProvider, - ) async { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - if (widget.businessReview != null) { - await MihMzansiDirectoryServices() - .updateBusinessReview( - widget.businessReview!.idbusiness_ratings, - widget.businessReview!.business_id, - _reviewTitleController.text, - _reviewDescriptionController.text, - _reviewScoreController.text, - widget.businessReview!.rating_score, - widget.business.rating, - ) - .then((statusCode) async { - context.pop(); //Remove loading dialog - if (statusCode == 200) { - await refreshBusiness(directoryProvider); - successPopUp( - "Successfully Updated Review!", - "Your review has successfully been updated and will now appear under the business.", - ); - } else { - MihAlertServices().errorBasicAlert( - "Error Updating Review", - "There was an error updating your review. Please try again later.", - context, - ); - } - }); - } else { - await MihMzansiDirectoryServices() - .addBusinessReview( - profileProvider.user!.app_id, - widget.business.business_id, - _reviewTitleController.text, - _reviewDescriptionController.text, - _reviewScoreController.text, - widget.business.rating.isEmpty ? "0.0" : widget.business.rating, - ) - .then((statusCode) async { - context.pop(); //Remove loading dialog - if (statusCode == 201) { - await refreshBusiness(directoryProvider); - successPopUp( - "Successfully Added Review!", - "Your review has successfully been added and will now appear under the business.", - ); - } else { - MihAlertServices().errorBasicAlert( - "Error Adding Review", - "There was an error adding your review. Please try again later.", - context, - ); - } - }); - } - } - - void successPopUp(String title, String message) { - MihAlertServices().successAdvancedAlert( - title, - message, - [ - MihButton( - onPressed: () { - context.pop(); - context.pop(); - widget.onSuccessDismissPressed!.call(); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - String getWindowTitle() { - if (widget.readOnly) { - return "Review Details"; - } else if (widget.businessReview != null) { - return "Update Review"; - } else { - return "Add Review"; - } - } - - @override - void dispose() { - super.dispose(); - _reviewDescriptionController.removeListener(_reviewDescriptionListener); - } - - @override - void initState() { - super.initState(); - _reviewDescriptionListener = () { - setState(() { - _counter.value = _reviewDescriptionController.text.characters.length; - }); - }; - _reviewDescriptionController.addListener(_reviewDescriptionListener); - if (widget.businessReview != null) { - setState(() { - _reviewTitleController.text = widget.businessReview!.rating_title; - _reviewDescriptionController.text = - widget.businessReview!.rating_description; - _reviewScoreController.text = widget.businessReview!.rating_score; - _reviewReviewerController.text = widget.businessReview!.reviewer; - }); - } else { - _reviewScoreController.text = "1.0"; // Default score - } - } - - @override - Widget build(BuildContext context) { - // return const Placeholder(); - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - MzansiDirectoryProvider directoryProvider, Widget? child) { - return MihPackageWindow( - fullscreen: false, - windowTitle: getWindowTitle(), - onWindowTapClose: () { - Navigator.of(context).pop(); - }, - menuOptions: widget.businessReview != null && !widget.readOnly - ? [ - SpeedDialChild( - child: Icon( - Icons.delete, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - label: "Delete Review", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - showDeleteReviewAlert(directoryProvider); - }, - ), - ] - : null, - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: MzansiInnovationHub.of(context)!.theme.screenType == - "desktop" - ? EdgeInsets.symmetric(horizontal: widget.screenWidth * 0.05) - : EdgeInsets.symmetric(horizontal: widget.screenWidth * 0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - MihForm( - formKey: _formKey, - formFields: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "Business Rating", - textAlign: TextAlign.left, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const SizedBox(height: 4), - widget.readOnly - ? RatingBar.readOnly( - size: 50, - alignment: Alignment.centerLeft, - filledIcon: Icons.star, - emptyIcon: Icons.star_border, - halfFilledIcon: Icons.star_half, - filledColor: MihColors.getYellowColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - // filledColor: MzansiInnovationHub.of(context)! - // .theme - // .secondaryColor(), - emptyColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - halfFilledColor: MihColors.getYellowColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - // MzansiInnovationHub.of(context)! - // .theme - // .secondaryColor(), - isHalfAllowed: true, - initialRating: widget.businessReview != null - ? double.parse(_reviewScoreController.text) - : 1, - maxRating: 5, - ) - : RatingBar( - size: 50, - alignment: Alignment.centerLeft, - filledIcon: Icons.star, - emptyIcon: Icons.star_border, - halfFilledIcon: Icons.star_half, - filledColor: MihColors.getYellowColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - emptyColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - halfFilledColor: MihColors.getYellowColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - isHalfAllowed: true, - initialRating: widget.businessReview != null - ? double.parse(_reviewScoreController.text) - : 1, - maxRating: 5, - onRatingChanged: (double) { - setState(() { - _reviewScoreController.text = - double.toStringAsFixed(1); - }); - print(_reviewScoreController.text); - }, - ), - Visibility( - visible: widget.readOnly, - child: const SizedBox(height: 10), - ), - Visibility( - visible: widget.readOnly, - child: MihTextFormField( - // width: 200, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: _reviewReviewerController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Reviewer", - validator: (value) { - return null; - }, - ), - ), - const SizedBox(height: 10), - MihTextFormField( - // width: 200, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: _reviewTitleController, - multiLineInput: false, - requiredText: true, - readOnly: widget.readOnly, - hintText: "Review Title", - validator: (value) { - return MihValidationServices() - .isEmpty(_reviewTitleController.text); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - height: 250, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: _reviewDescriptionController, - multiLineInput: true, - requiredText: widget.readOnly, - readOnly: widget.readOnly, - hintText: "Review Description", - validator: (value) { - if (_reviewDescriptionController.text.isEmpty) { - return null; - } else { - return MihValidationServices().validateLength( - _reviewDescriptionController.text, 256); - } - }, - ), - Visibility( - visible: !widget.readOnly, - child: SizedBox( - height: 15, - child: ValueListenableBuilder( - valueListenable: _counter, - builder: (BuildContext context, int value, - Widget? child) { - return Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - "$value", - style: TextStyle( - color: getMissionVisionLimitColor(256), - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(width: 5), - Text( - "/256", - style: TextStyle( - color: getMissionVisionLimitColor(256), - fontWeight: FontWeight.bold, - ), - ), - ], - ); - }, - ), - ), - ), - const SizedBox(height: 25), - Visibility( - visible: !widget.readOnly, - child: Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - submitForm( - profileProvider, - directoryProvider, - ); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - widget.businessReview != null - ? "Update Review" - : "Add Review", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ), - ], - ), - ], - ), - ), - ), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_update_business_details_window.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_update_business_details_window.dart deleted file mode 100644 index 80f294ec..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_update_business_details_window.dart +++ /dev/null @@ -1,677 +0,0 @@ -import 'package:country_code_picker/country_code_picker.dart'; -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_location_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:provider/provider.dart'; - -class MihUpdateBusinessDetailsWindow extends StatefulWidget { - final double width; - const MihUpdateBusinessDetailsWindow({ - super.key, - required this.width, - }); - - @override - State createState() => - _MihUpdateBusinessDetailsWindowState(); -} - -class _MihUpdateBusinessDetailsWindowState - extends State { - final _formKey = GlobalKey(); - PlatformFile? newSelectedLogoPic; - final fileNameController = TextEditingController(); - final regController = TextEditingController(); - final nameController = TextEditingController(); - final typeController = TextEditingController(); - final practiceNoController = TextEditingController(); - final vatNoController = TextEditingController(); - final countryCodeController = TextEditingController(); - final contactController = TextEditingController(); - final emailController = TextEditingController(); - final locationController = TextEditingController(); - final websiteController = TextEditingController(); - final ratingController = TextEditingController(); - final missionVisionController = TextEditingController(); - final ValueNotifier _counter = ValueNotifier(0); - late String env; - - void setContactNumberControllers( - MzansiProfileProvider mzansiProfileProvider) { - if (mzansiProfileProvider.business!.contact_no[0] == "+") { - List contactDetails = - mzansiProfileProvider.business!.contact_no.split("-"); - setState(() { - countryCodeController.text = contactDetails[0]; - contactController.text = contactDetails[1]; - }); - } else { - setState(() { - countryCodeController.text = "+27"; - contactController.text = mzansiProfileProvider.business!.contact_no; - }); - } - } - - void setControllers() { - MzansiProfileProvider mzansiProfileProvider = - context.read(); - setState(() { - fileNameController.text = - mzansiProfileProvider.business!.logo_path.split("/").last; - regController.text = mzansiProfileProvider.business!.registration_no; - nameController.text = mzansiProfileProvider.business!.Name; - typeController.text = mzansiProfileProvider.business!.type; - practiceNoController.text = mzansiProfileProvider.business!.practice_no; - vatNoController.text = mzansiProfileProvider.business!.vat_no; - emailController.text = mzansiProfileProvider.business!.bus_email; - locationController.text = mzansiProfileProvider.business!.gps_location; - websiteController.text = mzansiProfileProvider.business!.website; - ratingController.text = mzansiProfileProvider.business!.rating; - missionVisionController.text = - mzansiProfileProvider.business!.mission_vision; - }); - setContactNumberControllers(mzansiProfileProvider); - if (AppEnviroment.getEnv() == "Prod") { - env = "Prod"; - } else { - env = "Dev"; - } - } - - Color getMissionVisionLimitColor(int limit) { - if (_counter.value <= limit) { - return MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } else { - return MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } - } - - void _updateMissionVisionCounter() { - // New function name - // No need for setState since you are using a ValueNotifier for _counter - _counter.value = missionVisionController.text.characters.length; - } - - String getNumberWithCountryCode() { - String numberWithoutBeginingZero = ""; - if (contactController.text[0] == "0") { - numberWithoutBeginingZero = contactController.text - .replaceAll(" ", "") - .substring(1, contactController.text.length); - } else { - numberWithoutBeginingZero = contactController.text.replaceAll("-", " "); - } - return "${countryCodeController.text}-$numberWithoutBeginingZero"; - } - - bool isFormFilled() { - if (typeController.text.isEmpty) { - return false; - } else { - return true; - } - } - - void successPopUp(String message, bool stayOnPersonalSide) { - MihAlertServices().successBasicAlert( - "Success!", - message, - context, - ); - } - - Future uploadFile(MzansiProfileProvider mzansiProfileProvider) async { - if (newSelectedLogoPic != null) { - int uploadStatusCode = 0; - uploadStatusCode = await MihFileApi.uploadFile( - mzansiProfileProvider.business!.business_id, - env, - "business_files", - newSelectedLogoPic!, - context, - ); - if (uploadStatusCode == 200) { - int deleteStatusCode = 0; - deleteStatusCode = await MihFileApi.deleteFile( - mzansiProfileProvider.business!.logo_path.split("/").first, - env, - "business_files", - mzansiProfileProvider.business!.logo_path.split("/").last, - context, - ); - if (deleteStatusCode == 200) { - return true; - } else { - return false; - } - } else { - return false; - } - } else { - return true; // No file selected, so no upload needed - } - } - - Future submitForm(MzansiProfileProvider mzansiProfileProvider) async { - KenLogger.success("Start Submit Form"); - if (isFormFilled()) { - KenLogger.success("Form Filled"); - KenLogger.success("Start File Upload"); - bool successfullyUploadedFile = await uploadFile(mzansiProfileProvider); - KenLogger.success( - "File Upload Complete: outcome $successfullyUploadedFile"); - if (!mounted) return; - KenLogger.success("is mounted"); - if (successfullyUploadedFile) { - KenLogger.success("Start Details Update"); - int statusCode = 0; - statusCode = await MihBusinessDetailsServices().updateBusinessDetailsV2( - mzansiProfileProvider.business!.business_id, - nameController.text, - typeController.text, - regController.text, - practiceNoController.text, - vatNoController.text, - emailController.text, - getNumberWithCountryCode(), - // contactController.text, - locationController.text, - fileNameController.text, - websiteController.text, - ratingController.text.isEmpty ? "0" : ratingController.text, - missionVisionController.text, - mzansiProfileProvider, - context, - ); - KenLogger.success("Details Update Complete: status code $statusCode"); - if (!mounted) return; - KenLogger.success("is mounted"); - if (statusCode == 200) { - KenLogger.success("Start Success Message"); - //You left of here - String message = "Your information has been updated successfully!"; - context.pop(); - successPopUp(message, false); - // File uploaded successfully - } else { - context.pop(); - // File upload failed - MihAlertServices().errorBasicAlert( - "Error Updating Business Details", - "An error occurred while updating the business details. Please try again.", - context, - ); - } - } else { - context.pop(); - if (!mounted) return; - MihAlertServices().internetConnectionAlert(context); - } - } else { - MihAlertServices().inputErrorAlert(context); - } - } - - @override - void initState() { - super.initState(); - setControllers(); - missionVisionController.addListener(_updateMissionVisionCounter); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - return MihPackageWindow( - fullscreen: false, - windowTitle: 'Edit Profile', - onWindowTapClose: () { - context.pop(); - }, - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: widget.width * 0.05) - : EdgeInsets.symmetric(horizontal: widget.width * 0), - child: Stack( - children: [ - Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - Center( - child: MihCircleAvatar( - imageFile: newSelectedLogoPic != null - ? MemoryImage(newSelectedLogoPic!.bytes!) - : mzansiProfileProvider - .businessProfilePicture, - width: 150, - expandable: false, - editable: true, - fileNameController: fileNameController, - userSelectedfile: newSelectedLogoPic, - frameColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onChange: (selectedfile) { - setState(() { - newSelectedLogoPic = selectedfile; - }); - }, - ), - ), - Visibility( - visible: false, - child: MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: fileNameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Selected File Name", - ), - ), - const SizedBox(height: 20), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: nameController, - multiLineInput: false, - requiredText: true, - hintText: "Business Name", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: typeController, - multiLineInput: false, - requiredText: true, - hintText: "Business Type", - validator: (value) { - return MihValidationServices() - .validateNoSpecialChars(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: emailController, - multiLineInput: false, - requiredText: true, - hintText: "Business Email", - validator: (value) { - return MihValidationServices() - .validateEmail(value); - }, - ), - const SizedBox(height: 10), - Container( - width: 300, - alignment: Alignment.topLeft, - child: const Text( - "Contact Number:", - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - CountryCodePicker( - padding: EdgeInsetsGeometry.all(0), - onChanged: (selectedCode) { - setState(() { - countryCodeController.text = - selectedCode.toString(); - }); - debugPrint( - "Selected Country Code: ${countryCodeController.text}"); - }, - initialSelection: countryCodeController.text, - showDropDownButton: false, - pickerStyle: PickerStyle.bottomSheet, - dialogBackgroundColor: - MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - barrierColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - Expanded( - child: MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - controller: contactController, - numberMode: true, - multiLineInput: false, - requiredText: true, - hintText: null, - validator: (value) { - return MihValidationServices() - .isEmpty(value); - }, - ), - ), - ], - ), - const SizedBox(height: 10), - MihTextFormField( - height: 250, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: missionVisionController, - multiLineInput: true, - requiredText: true, - hintText: "Business Mission & Vision", - validator: (value) { - return MihValidationServices().validateLength( - missionVisionController.text, 256); - }, - ), - SizedBox( - height: 15, - child: ValueListenableBuilder( - valueListenable: _counter, - builder: (BuildContext context, int value, - Widget? child) { - return Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - "$value", - style: TextStyle( - color: getMissionVisionLimitColor(256), - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(width: 5), - Text( - "/256", - style: TextStyle( - color: getMissionVisionLimitColor(256), - fontWeight: FontWeight.bold, - ), - ), - ], - ); - }, - ), - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: websiteController, - multiLineInput: false, - requiredText: false, - hintText: "Business Website", - validator: (value) { - return MihValidationServices() - .validateWebsite(value, false); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: regController, - multiLineInput: false, - requiredText: false, - hintText: "Registration No.", - validator: (value) { - // return MihValidationServices().isEmpty(value); - return null; - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: practiceNoController, - multiLineInput: false, - requiredText: false, - hintText: "Practice Number", - validator: (validateValue) { - return null; - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: vatNoController, - multiLineInput: false, - requiredText: false, - hintText: "VAT Number", - validator: (value) { - // return MihValidationServices().isEmpty(value); - return null; - }, - ), - const SizedBox(height: 10), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Flexible( - child: MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - controller: locationController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "GPS Location", - ), - ), - const SizedBox(width: 10.0), - MihButton( - onPressed: () { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle( - message: "Getting your location", - ); - }, - ); - MIHLocationAPI() - .getGPSPosition(context) - .then((position) { - if (position != null) { - setState(() { - locationController.text = - "${position.latitude}, ${position.longitude}"; - }); - } - //Dismiss loading indicator - context.pop(); - }); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - width: 100, - child: Text( - "Set", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - const SizedBox(height: 25), - Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - submitForm(mzansiProfileProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Update", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - const SizedBox(height: 20), - ], - ), - ], - ), - Positioned( - right: 0, - top: 0, - child: MihButton( - onPressed: () { - //Add validation here - if (_formKey.currentState!.validate()) { - submitForm(mzansiProfileProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 100, - height: 25, - child: Text( - mzansiProfileProvider.user!.username.isEmpty - ? "Setup Profile" - : "Update", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 15, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ), - ), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_update_my_business_user_details.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_update_my_business_user_details.dart deleted file mode 100644 index 7217dbc7..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/components/mih_update_my_business_user_details.dart +++ /dev/null @@ -1,405 +0,0 @@ -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_image_display.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_my_business_user_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:provider/provider.dart'; - -class MihUpdateMyBusinessUserDetails extends StatefulWidget { - const MihUpdateMyBusinessUserDetails({super.key}); - - @override - State createState() => - _MihUpdateMyBusinessUserDetailsState(); -} - -class _MihUpdateMyBusinessUserDetailsState - extends State { - final fileNameController = TextEditingController(); - final titleTextController = TextEditingController(); - final fnameController = TextEditingController(); - final lnameController = TextEditingController(); - final accessController = TextEditingController(); - final signtureController = TextEditingController(); - final _formKey = GlobalKey(); - PlatformFile? userPicFile; - PlatformFile? newSelectedSignaturePic; - late String env; - - bool isFormFilled() { - if (titleTextController.text.isEmpty) { - return false; - } else { - return true; - } - } - - Future uploadFile(MzansiProfileProvider mzansiProfileProvider) async { - if (newSelectedSignaturePic != null) { - int uploadStatusCode = 0; - uploadStatusCode = await MihFileApi.uploadFile( - mzansiProfileProvider.user!.app_id, - env, - "business_files", - newSelectedSignaturePic!, - context, - ); - if (uploadStatusCode == 200) { - signtureController.text = newSelectedSignaturePic!.name; - int deleteStatusCode = 0; - deleteStatusCode = await MihFileApi.deleteFile( - mzansiProfileProvider.user!.app_id, - env, - "business_files", - mzansiProfileProvider.businessUser!.sig_path.split("/").last, - context, - ); - if (deleteStatusCode == 200) { - return true; - } else { - return false; - } - } else { - return false; - } - } else { - return true; // No file selected, so no upload needed - } - } - - Future submitForm(MzansiProfileProvider mzansiProfileProvider) async { - if (isFormFilled()) { - bool successfullyUploadedFile = await uploadFile(mzansiProfileProvider); - if (!mounted) return; - if (successfullyUploadedFile) { - int statusCode = await MihMyBusinessUserServices().updateBusinessUser( - mzansiProfileProvider.user!.app_id, - mzansiProfileProvider.businessUser!.business_id, - titleTextController.text, - accessController.text, - signtureController.text, - mzansiProfileProvider, - context, - ); - if (!mounted) return; - if (statusCode == 200) { - String message = "Business details updated successfully"; - context.pop(); - successPopUp(message, false); - } else { - MihAlertServices().errorBasicAlert( - "Error Updating Business User Details", - "An error occurred while updating the business User details. Please check internet connection and try again.", - context, - ); - } - } else { - MihAlertServices().internetConnectionAlert(context); - } - } else { - MihAlertServices().inputErrorAlert(context); - } - } - - void successPopUp(String message, bool stayOnPersonalSide) { - MihAlertServices().successBasicAlert( - "Success!", - message, - context, - ); - } - - Widget getWindowBody(double width) { - return Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - return MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0.075), - child: Stack( - children: [ - Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - // Center( - // child: MihCircleAvatar( - // imageFile: mzansiProfileProvider.userProfilePicture, - // width: 150, - // editable: false, - // fileNameController: fileNameController, - // userSelectedfile: userPicFile, - // frameColor: MihColors.getSecondaryColor( - // MzansiInnovationHub.of(context)!.theme.mode == - // "Dark"), - // backgroundColor: MihColors.getPrimaryColor( - // MzansiInnovationHub.of(context)!.theme.mode == - // "Dark"), - // onChange: (_) {}, - // ), - // ), - Visibility( - visible: false, - child: MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: fileNameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Selected File Name", - ), - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: titleTextController, - multiLineInput: false, - requiredText: true, - readOnly: false, - hintText: "Title", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: fnameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "First Name", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: lnameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Surname", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: accessController, - multiLineInput: false, - requiredText: true, - hintText: "Access Level", - readOnly: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - Container( - width: 300, - alignment: Alignment.topLeft, - child: const Text( - "Signature:", - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ), - Center( - child: MihImageDisplay( - imageFile: newSelectedSignaturePic != null - ? MemoryImage(newSelectedSignaturePic!.bytes!) - : mzansiProfileProvider.businessUserSignature, - width: 300, - height: 200, - editable: true, - fileNameController: signtureController, - userSelectedfile: newSelectedSignaturePic, - onChange: (selectedFile) { - setState(() { - newSelectedSignaturePic = selectedFile; - }); - }, - ), - ), - const SizedBox(height: 10), - Visibility( - visible: false, - child: MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: fileNameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Selected Signature File", - ), - ), - const SizedBox(height: 15), - Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - submitForm(mzansiProfileProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Update", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - const SizedBox(height: 20), - ], - ), - ], - ), - Positioned( - top: 0, - right: 0, - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - submitForm(mzansiProfileProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 100, - height: 25, - child: Text( - "Update", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 15, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ), - ); - }, - ); - } - - void setControllers() { - MzansiProfileProvider mzansiProfileProvider = - context.read(); - fileNameController.text = - mzansiProfileProvider.user!.pro_pic_path.split("/").last; - signtureController.text = - mzansiProfileProvider.businessUser!.sig_path.split("/").last; - titleTextController.text = mzansiProfileProvider.businessUser!.title; - fnameController.text = mzansiProfileProvider.user!.fname; - lnameController.text = mzansiProfileProvider.user!.lname; - accessController.text = mzansiProfileProvider.businessUser!.access; - if (AppEnviroment.getEnv() == "Prod") { - env = "Prod"; - } else { - env = "Dev"; - } - } - - @override - void dispose() { - super.dispose(); - fileNameController.dispose(); - titleTextController.dispose(); - fnameController.dispose(); - lnameController.dispose(); - accessController.dispose(); - signtureController.dispose(); - userPicFile = null; - newSelectedSignaturePic = null; - } - - @override - void initState() { - super.initState(); - setControllers(); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageWindow( - fullscreen: false, - windowTitle: "Edit Profile", - onWindowTapClose: () { - context.pop(); - }, - windowBody: getWindowBody(screenWidth), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/mzansi_business_profile_view.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/mzansi_business_profile_view.dart deleted file mode 100644 index df8a9795..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/mzansi_business_profile_view.dart +++ /dev/null @@ -1,155 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details_view.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_qr_code.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_reviews.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart'; -import 'package:provider/provider.dart'; - -class MzansiBusinessProfileView extends StatefulWidget { - final String? businessId; - final bool fromMzansiDirectory; - const MzansiBusinessProfileView({ - super.key, - required this.businessId, - required this.fromMzansiDirectory, - }); - - @override - State createState() => - _MzansiBusinessProfileViewState(); -} - -class _MzansiBusinessProfileViewState extends State { - int _selcetedIndex = 0; - late final MihBusinessDetailsView _businessDetailsView; - late final MihBusinessReviews _businessReviews; - late final MihBusinessQrCode _businessQrCode; - - Future _fetchBusinessDetails( - MzansiDirectoryProvider directoryProvider) async { - if (widget.businessId != null) { - final biz = await MihBusinessDetailsServices() - .getBusinessDetailsByBusinessId(widget.businessId!); - if (biz == null) { - context.goNamed( - 'mihHome', - extra: true, - ); - } else { - KenLogger.success("Business found: ${biz.Name}"); - directoryProvider.setSelectedBusiness(business: biz); - } - } - _businessDetailsView = MihBusinessDetailsView(); - _businessReviews = - MihBusinessReviews(business: directoryProvider.selectedBusiness!); - _businessQrCode = MihBusinessQrCode( - business: directoryProvider.selectedBusiness!, - ); - } - - @override - void initState() { - super.initState(); - MzansiDirectoryProvider directoryProvider = - context.read(); - _fetchBusinessDetails(directoryProvider); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, MzansiDirectoryProvider directoryProvider, - Widget? child) { - if (directoryProvider.selectedBusiness == null) { - KenLogger.warning("Business is null, showing loading indicator"); - return Scaffold( - body: const Center( - child: Mihloadingcircle(), - ), - ); - } else { - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(directoryProvider), - appToolTitles: getToolTitle(), - selectedbodyIndex: _selcetedIndex, - onIndexChange: (newValue) { - setState(() { - _selcetedIndex = newValue; - }); - }, - ); - } - }, - ); - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - if (!widget.fromMzansiDirectory) { - context.goNamed( - 'mihHome', - ); - } else { - context.pop(); - } - // context.goNamed( - // "mzansiDirectory", - // ); - FocusScope.of(context).unfocus(); - }, - ); - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.business)] = () { - setState(() { - _selcetedIndex = 0; - }); - }; - temp[const Icon(Icons.star_rate_rounded)] = () { - setState(() { - _selcetedIndex = 1; - }); - }; - temp[const Icon(Icons.qr_code_rounded)] = () { - setState(() { - _selcetedIndex = 2; - }); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: _selcetedIndex, - ); - } - - List getToolBody(MzansiDirectoryProvider directoryProvider) { - return [ - _businessDetailsView, - _businessReviews, - _businessQrCode, - ]; - } - - List getToolTitle() { - List toolTitles = [ - "Profile", - "Reviews", - "Share Business", - ]; - return toolTitles; - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/mzansi_set_up_business_profile.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/mzansi_set_up_business_profile.dart deleted file mode 100644 index 852ae249..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/mzansi_set_up_business_profile.dart +++ /dev/null @@ -1,79 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details_set_up.dart'; -import 'package:provider/provider.dart'; - -class MzansiSetUpBusinessProfile extends StatefulWidget { - const MzansiSetUpBusinessProfile({super.key}); - - @override - State createState() => - _MzansiSetUpBusinessProfileState(); -} - -class _MzansiSetUpBusinessProfileState - extends State { - late final MihBusinessDetailsSetUp _businessDetailsSetUp; - - @override - void initState() { - _businessDetailsSetUp = MihBusinessDetailsSetUp(); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: getToolTitle(), - selectedbodyIndex: context.watch().businessIndex, - onIndexChange: (newIndex) { - context.read().setBusinessIndex(newIndex); - }, - ); - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - context.goNamed( - 'mihHome', - ); - FocusScope.of(context).unfocus(); - context.read().setBusinessIndex(0); - }, - ); - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.business)] = () { - context.read().setBusinessIndex(0); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: context.watch().businessIndex, - ); - } - - List getToolTitle() { - List toolTitles = [ - "Set Up Profile", - ]; - return toolTitles; - } - - List getToolBody() { - return [ - _businessDetailsSetUp, - ]; - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tiles/mzansi_business_profile_tile.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tiles/mzansi_business_profile_tile.dart deleted file mode 100644 index d9a26e98..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tiles/mzansi_business_profile_tile.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MzansiBusinessProfileTile extends StatefulWidget { - final double packageSize; - const MzansiBusinessProfileTile({ - super.key, - required this.packageSize, - }); - - @override - State createState() => - _MzansiBusinessProfileTileState(); -} - -class _MzansiBusinessProfileTileState extends State { - @override - Widget build(BuildContext context) { - return MihPackageTile( - onTap: () { - context.goNamed( - "businessProfileManage", - ); - // Navigator.of(context).pushNamed( - // '/business-profile/manage', - // arguments: widget.arguments, - // ); - }, - appName: "Business Profile", - appIcon: Icon( - MihIcons.businessProfile, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // size: widget.packageSize, - ), - iconSize: widget.packageSize, - textColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tiles/mzansi_setup_business_profile_tile.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tiles/mzansi_setup_business_profile_tile.dart deleted file mode 100644 index 470bd19b..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tiles/mzansi_setup_business_profile_tile.dart +++ /dev/null @@ -1,50 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:provider/provider.dart'; - -class MzansiSetupBusinessProfileTile extends StatefulWidget { - final double packageSize; - const MzansiSetupBusinessProfileTile({ - super.key, - required this.packageSize, - }); - - @override - State createState() => - _MzansiSetupBusinessProfileTileState(); -} - -class _MzansiSetupBusinessProfileTileState - extends State { - @override - Widget build(BuildContext context) { - MzansiProfileProvider profileProvider = - context.read(); - return MihPackageTile( - onTap: () { - context.goNamed( - 'businessProfileSetup', - extra: profileProvider.user, - ); - // Navigator.of(context).pushNamed( - // '/business-profile/set-up', - // arguments: widget.signedInUser, - // ); - }, - appName: "Set Up Business", - appIcon: Icon( - MihIcons.businessSetup, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - iconSize: widget.packageSize, - textColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details.dart deleted file mode 100644 index 9b5df943..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details.dart +++ /dev/null @@ -1,207 +0,0 @@ -import 'package:custom_rating_bar/custom_rating_bar.dart'; -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_business_info_card_v2.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_update_business_details_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:provider/provider.dart'; - -class MihBusinessDetails extends StatefulWidget { - const MihBusinessDetails({ - super.key, - }); - - @override - State createState() => _MihBusinessDetailsState(); -} - -class _MihBusinessDetailsState extends State { - PlatformFile? newSelectedLogoPic; - final fileNameController = TextEditingController(); - - void editBizProfileWindow( - MzansiProfileProvider mzansiProfileProvider, double width) { - showDialog( - barrierDismissible: false, - context: context, - builder: (context) => MihUpdateBusinessDetailsWindow(width: width), - ); - } - - @override - void dispose() { - super.dispose(); - } - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - innerHorizontalPadding: 10, - bodyItem: getBody(screenWidth, context), - ); - } - - Widget getBody(double width, BuildContext context) { - return Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - return Stack( - children: [ - MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: MzansiInnovationHub.of(context)!.theme.screenType == - "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0), - child: Column( - children: [ - Center( - child: Stack( - children: [ - MihCircleAvatar( - key: UniqueKey(), - imageFile: - mzansiProfileProvider.businessProfilePicture, - width: 150, - expandable: true, - editable: false, - fileNameController: fileNameController, - userSelectedfile: newSelectedLogoPic, - frameColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onChange: (selectedfile) { - setState(() { - newSelectedLogoPic = selectedfile; - }); - }, - ), - Positioned( - bottom: 5, - right: 5, - child: MihButton( - onPressed: () { - // editProfileWindow(width); - editBizProfileWindow( - mzansiProfileProvider, width); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 35, - height: 35, - child: Icon( - Icons.edit, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - ), - ], - ), - ), - FittedBox( - child: Text( - mzansiProfileProvider.business!.Name, - style: TextStyle( - fontSize: 35, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - FittedBox( - child: Text( - mzansiProfileProvider.business!.type, - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w600, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - RatingBar.readOnly( - size: 50, - alignment: Alignment.center, - filledIcon: Icons.star, - emptyIcon: Icons.star_border, - halfFilledIcon: Icons.star_half, - filledColor: MihColors.getYellowColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - // MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - emptyColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - halfFilledColor: MihColors.getYellowColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - // MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - isHalfAllowed: true, - initialRating: mzansiProfileProvider - .business!.rating.isNotEmpty - ? double.parse(mzansiProfileProvider.business!.rating) - : 0, - maxRating: 5, - ), - const SizedBox(height: 5), - Center( - child: SizedBox( - width: 700, - child: Text( - mzansiProfileProvider - .business!.mission_vision.isNotEmpty - ? mzansiProfileProvider.business!.mission_vision - : "No Mission & Vision added yet", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - ), - const SizedBox(height: 20), - MihBusinessCardV2( - business: mzansiProfileProvider.business!, - // startUpSearch: null, - width: width, - ), - const SizedBox(height: 30.0), - ], - ), - ), - ), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details_set_up.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details_set_up.dart deleted file mode 100644 index 9564774e..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details_set_up.dart +++ /dev/null @@ -1,791 +0,0 @@ -import 'package:country_code_picker/country_code_picker.dart'; -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:go_router/go_router.dart'; -import 'package:http/http.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_image_display.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_location_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_my_business_user_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:provider/provider.dart'; - -class MihBusinessDetailsSetUp extends StatefulWidget { - const MihBusinessDetailsSetUp({super.key}); - - @override - State createState() => - _MihBusinessDetailsSetUpState(); -} - -class _MihBusinessDetailsSetUpState extends State { - final nameController = TextEditingController(); - final typeController = TextEditingController(); - final regController = TextEditingController(); - final addressController = TextEditingController(); - final fnameController = TextEditingController(); - final lnameController = TextEditingController(); - final titleController = TextEditingController(); - final signtureController = TextEditingController(); - final accessController = TextEditingController(); - final countryCodeController = TextEditingController(); - final contactController = TextEditingController(); - final emailController = TextEditingController(); - final locationController = TextEditingController(); - final practiceNoController = TextEditingController(); - final vatNoController = TextEditingController(); - final websiteController = TextEditingController(); - final ratingController = TextEditingController(); - final missionVisionController = TextEditingController(); - final logoFileNameController = TextEditingController(); - PlatformFile? newSelectedLogoPic; - PlatformFile? newSelectedSignaturePic; - final FocusNode _focusNode = FocusNode(); - final _formKey = GlobalKey(); - final ValueNotifier _counter = ValueNotifier(0); - final ValueNotifier busType = ValueNotifier(""); - late String env; - - void submitForm(MzansiProfileProvider mzansiProfileProvider) { - if (isFieldsFilled()) { - createBusinessProfileAPICall(mzansiProfileProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - } - - Future createBusinessProfileAPICall( - MzansiProfileProvider mzansiProfileProvider) async { - Response response = - await MihBusinessDetailsServices().createBusinessDetails( - mzansiProfileProvider, - nameController.text, - typeController.text, - regController.text, - practiceNoController.text, - vatNoController.text, - emailController.text, - getNumberWithCountryCode(), - locationController.text, - logoFileNameController.text, - websiteController.text, - "0", - missionVisionController.text, - context, - ); - if (response.statusCode == 201) { - bool successUpload = - await uploadFile(mzansiProfileProvider, newSelectedLogoPic); - if (successUpload) { - String logoUrl = await MihFileApi.getMinioFileUrl( - mzansiProfileProvider.business!.logo_path); - mzansiProfileProvider.setBusinessProfilePicUrl(logoUrl); - } - await createBusinessUserAPICall(mzansiProfileProvider); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - Future createBusinessUserAPICall( - MzansiProfileProvider mzansiProfileProvider) async { - int statusCode = await MihMyBusinessUserServices().createBusinessUser( - mzansiProfileProvider.business!.business_id, - mzansiProfileProvider.user!.app_id, - signtureController.text, - titleController.text, - accessController.text, - mzansiProfileProvider, - context, - ); - if (statusCode == 201) { - bool successUpload = - await uploadFile(mzansiProfileProvider, newSelectedSignaturePic); - if (successUpload) { - String sigUrl = await MihFileApi.getMinioFileUrl( - mzansiProfileProvider.businessUser!.sig_path); - mzansiProfileProvider.setBusinessUserSignatureUrl(sigUrl); - String message = - "Your business profile is now live! You can now start connecting with customers and growing your business."; - successPopUp(message, false); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - Future uploadFile( - MzansiProfileProvider mzansiProfileProvider, PlatformFile? image) async { - if (newSelectedLogoPic != null) { - int uploadStatusCode = 0; - uploadStatusCode = await MihFileApi.uploadFile( - mzansiProfileProvider.business!.business_id, - env, - "business_files", - image, - context, - ); - if (uploadStatusCode == 200) { - return true; - } else { - return false; - } - } else { - return true; // No file selected, so no upload needed - } - } - - bool isFieldsFilled() { - if (typeController.text.isEmpty || - titleController.text.isEmpty || - accessController.text.isEmpty) { - return false; - } else { - return true; - } - } - - String getNumberWithCountryCode() { - String numberWithoutBeginingZero = ""; - if (contactController.text[0] == "0") { - numberWithoutBeginingZero = contactController.text - .replaceAll(" ", "") - .substring(1, contactController.text.length); - } else { - numberWithoutBeginingZero = contactController.text.replaceAll("-", " "); - } - return "${countryCodeController.text}-$numberWithoutBeginingZero"; - } - - Color getMissionVisionLimitColor(int limit) { - if (_counter.value <= limit) { - return MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } else { - return MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } - } - - void typeSelected() { - if (typeController.text.isNotEmpty) { - busType.value = typeController.text; - } else { - busType.value = ""; - } - } - - void successPopUp(String message, bool stayOnPersonalSide) { - MihAlertServices().successAdvancedAlert( - "Successfully Updated Profile", - message, - [ - MihButton( - onPressed: () { - context.goNamed( - 'mihHome', - extra: stayOnPersonalSide, - ); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - void initialiseControlers(MzansiProfileProvider mzansiProfileProvider) { - typeController.addListener(typeSelected); - setState(() { - fnameController.text = mzansiProfileProvider.user!.fname; - lnameController.text = mzansiProfileProvider.user!.lname; - accessController.text = "Full"; - countryCodeController.text = "+27"; - }); - if (AppEnviroment.getEnv() == "Prod") { - env = "Prod"; - } else { - env = "Dev"; - } - missionVisionController.addListener(() { - setState(() { - _counter.value = missionVisionController.text.characters.length; - }); - }); - } - - @override - void dispose() { - typeController.removeListener(typeSelected); - nameController.dispose(); - typeController.dispose(); - regController.dispose(); - addressController.dispose(); - fnameController.dispose(); - lnameController.dispose(); - titleController.dispose(); - signtureController.dispose(); - accessController.dispose(); - countryCodeController.dispose(); - contactController.dispose(); - emailController.dispose(); - locationController.dispose(); - practiceNoController.dispose(); - vatNoController.dispose(); - websiteController.dispose(); - ratingController.dispose(); - missionVisionController.dispose(); - logoFileNameController.dispose(); - busType.dispose(); - _focusNode.dispose(); - _counter.dispose(); - super.dispose(); - } - - @override - void initState() { - super.initState(); - initialiseControlers(context.read()); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(screenWidth), - ); - } - - Widget getBody(double width) { - return Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - return KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - if (_formKey.currentState!.validate()) { - submitForm(mzansiProfileProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - } - }, - child: SingleChildScrollView( - child: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0.075), - child: Column( - children: [ - const Text( - "Business Details", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25, - ), - ), - Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark")), - const SizedBox(height: 10.0), - MihForm( - formKey: _formKey, - formFields: [ - Center( - child: MihCircleAvatar( - imageFile: newSelectedLogoPic != null - ? MemoryImage(newSelectedLogoPic!.bytes!) - : mzansiProfileProvider.businessProfilePicture, - width: 150, - expandable: false, - editable: true, - fileNameController: logoFileNameController, - userSelectedfile: newSelectedLogoPic, - frameColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onChange: (selectedfile) { - setState(() { - newSelectedLogoPic = selectedfile; - }); - }, - ), - ), - const SizedBox(height: 20), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: nameController, - multiLineInput: false, - requiredText: true, - hintText: "Business Name", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: typeController, - multiLineInput: false, - requiredText: true, - hintText: "Business Type", - validator: (value) { - return MihValidationServices() - .validateNoSpecialChars(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: emailController, - multiLineInput: false, - requiredText: true, - hintText: "Business Email", - validator: (value) { - return MihValidationServices().validateEmail(value); - }, - ), - const SizedBox(height: 10.0), - Container( - width: 300, - alignment: Alignment.topLeft, - child: const Text( - "Contact Number:", - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - CountryCodePicker( - padding: EdgeInsetsGeometry.all(0), - onChanged: (selectedCode) { - setState(() { - countryCodeController.text = - selectedCode.toString(); - }); - debugPrint( - "Selected Country Code: ${countryCodeController.text}"); - }, - initialSelection: countryCodeController.text, - showDropDownButton: false, - pickerStyle: PickerStyle.bottomSheet, - dialogBackgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - barrierColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - Expanded( - child: MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: contactController, - numberMode: true, - multiLineInput: false, - requiredText: true, - hintText: null, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - ), - ], - ), - const SizedBox(height: 10.0), - MihTextFormField( - height: 250, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: missionVisionController, - multiLineInput: true, - requiredText: true, - hintText: "Business Mission & Vision", - validator: (value) { - return MihValidationServices().validateLength( - missionVisionController.text, 256); - }, - ), - SizedBox( - height: 15, - child: ValueListenableBuilder( - valueListenable: _counter, - builder: - (BuildContext context, int value, Widget? child) { - return Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - "$value", - style: TextStyle( - color: getMissionVisionLimitColor(256), - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(width: 5), - Text( - "/256", - style: TextStyle( - color: getMissionVisionLimitColor(256), - fontWeight: FontWeight.bold, - ), - ), - ], - ); - }, - ), - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: websiteController, - multiLineInput: false, - requiredText: false, - hintText: "Business Website", - validator: (value) { - return MihValidationServices() - .validateWebsite(value, false); - }, - ), - const SizedBox(height: 10.0), - - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: regController, - multiLineInput: false, - requiredText: false, - hintText: "Registration No.", - validator: (value) { - // return MihValidationServices().isEmpty(value); - return null; - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: practiceNoController, - multiLineInput: false, - requiredText: false, - hintText: "Practice Number", - validator: (validateValue) { - return null; - }, - ), - - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: vatNoController, - multiLineInput: false, - requiredText: false, - hintText: "VAT Number", - validator: (value) { - // return MihValidationServices().isEmpty(value); - return null; - }, - ), - const SizedBox(height: 10.0), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Flexible( - child: MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: locationController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "GPS Location", - ), - ), - const SizedBox(width: 10.0), - MihButton( - onPressed: () { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle( - message: "Getting your location", - ); - }, - ); - MIHLocationAPI() - .getGPSPosition(context) - .then((position) { - if (position != null) { - setState(() { - locationController.text = - "${position.latitude}, ${position.longitude}"; - }); - } - Navigator.of(context).pop(); - }); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 100, - child: Text( - "Set", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - const SizedBox(height: 15.0), - //const SizedBox(height: 15.0), - const Center( - child: Text( - "Business User", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 22, - ), - ), - ), - Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark")), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: titleController, - multiLineInput: false, - requiredText: true, - hintText: "Title", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - // MihDropdownField( - // controller: titleController, - // hintText: "Title", - // dropdownOptions: const ["Doctor", "Assistant", "Other"], - // editable: true, - // enableSearch: true, - // validator: (value) { - // return MihValidationServices().isEmpty(value); - // }, - // requiredText: true, - // ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: fnameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "First Name", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: lnameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Surname", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: accessController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Access Type", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - Container( - width: 300, - alignment: Alignment.topLeft, - child: const Text( - "Signature:", - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ), - Center( - child: MihImageDisplay( - imageFile: newSelectedSignaturePic != null - ? MemoryImage(newSelectedSignaturePic!.bytes!) - : mzansiProfileProvider.businessUserSignature, - width: 300, - height: 200, - editable: true, - fileNameController: signtureController, - userSelectedfile: newSelectedSignaturePic, - onChange: (selectedFile) { - setState(() { - newSelectedSignaturePic = selectedFile; - }); - }, - ), - ), - const SizedBox(height: 20.0), - Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - submitForm(mzansiProfileProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Set Up Buasiness", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - const SizedBox(height: 30), - ], - ), - ], - ), - ), - ), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details_view.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details_view.dart deleted file mode 100644 index 5663c9d7..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_details_view.dart +++ /dev/null @@ -1,219 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:custom_rating_bar/custom_rating_bar.dart'; -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_business_info_card_v2.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:provider/provider.dart'; - -class MihBusinessDetailsView extends StatefulWidget { - const MihBusinessDetailsView({ - super.key, - }); - - @override - State createState() => _MihBusinessDetailsViewState(); -} - -class _MihBusinessDetailsViewState extends State { - late Future futureImageUrl; - PlatformFile? file; - - @override - void dispose() { - super.dispose(); - } - - @override - void initState() { - super.initState(); - MzansiDirectoryProvider directoryProvider = - context.read(); - futureImageUrl = MihFileApi.getMinioFileUrl( - directoryProvider.selectedBusiness!.logo_path); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - innerHorizontalPadding: 10, - bodyItem: getBody(screenWidth, context), - ); - } - - Widget getBody(double width, BuildContext context) { - double profilePictureWidth = 150; - return Consumer( - builder: (BuildContext context, MzansiDirectoryProvider directoryProvider, - Widget? child) { - return Stack( - children: [ - MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: MzansiInnovationHub.of(context)!.theme.screenType == - "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0), - child: Column( - children: [ - FutureBuilder( - future: futureImageUrl, - builder: (context, asyncSnapshot) { - if (asyncSnapshot.connectionState == - ConnectionState.done && - asyncSnapshot.hasData) { - if (asyncSnapshot.requireData != "") { - return MihCircleAvatar( - imageFile: CachedNetworkImageProvider( - asyncSnapshot.requireData), - width: profilePictureWidth, - expandable: true, - editable: false, - fileNameController: TextEditingController(), - userSelectedfile: file, - frameColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - onChange: () {}, - ); - } else { - return Icon( - MihIcons.iDontKnow, - size: profilePictureWidth, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ); - } - } else { - return Icon( - MihIcons.mihRing, - size: profilePictureWidth, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ); - } - }), - // Center( - // child: MihCircleAvatar( - // imageFile: widget.logoImage, - // width: 150, - // editable: false, - // fileNameController: fileNameController, - // userSelectedfile: imageFile, - // frameColor: - // MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // backgroundColor: - // MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // onChange: (selectedfile) { - // setState(() { - // imageFile = selectedfile; - // }); - // }, - // ), - // ), - FittedBox( - child: Text( - directoryProvider.selectedBusiness!.Name, - style: TextStyle( - fontSize: 35, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - FittedBox( - child: Text( - directoryProvider.selectedBusiness!.type, - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w600, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - RatingBar.readOnly( - size: 50, - alignment: Alignment.center, - filledIcon: Icons.star, - emptyIcon: Icons.star_border, - halfFilledIcon: Icons.star_half, - filledColor: MihColors.getYellowColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - // MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - emptyColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - halfFilledColor: MihColors.getYellowColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - // MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - isHalfAllowed: true, - initialRating: - directoryProvider.selectedBusiness!.rating.isNotEmpty - ? double.parse( - directoryProvider.selectedBusiness!.rating) - : 0, - maxRating: 5, - ), - const SizedBox(height: 5), - Center( - child: SizedBox( - width: 700, - child: Text( - directoryProvider - .selectedBusiness!.mission_vision.isNotEmpty - ? directoryProvider - .selectedBusiness!.mission_vision - : "No Mission & Vision added yet", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - ), - const SizedBox(height: 20), - MihBusinessCardV2( - business: directoryProvider.selectedBusiness!, - width: width, - ), - ], - ), - ), - ), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_qr_code.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_qr_code.dart deleted file mode 100644 index ab1142fa..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_qr_code.dart +++ /dev/null @@ -1,459 +0,0 @@ -import 'dart:io'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:file_picker/file_picker.dart'; -import 'package:file_saver/file_saver.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:provider/provider.dart'; -import 'package:screenshot/screenshot.dart'; -import 'package:share_plus/share_plus.dart'; -import 'package:supertokens_flutter/supertokens.dart'; - -class MihBusinessQrCode extends StatefulWidget { - final Business? business; - const MihBusinessQrCode({ - super.key, - required this.business, - }); - - @override - State createState() => _MihBusinessQrCodeState(); -} - -class _MihBusinessQrCodeState extends State { - late Future futureImageUrl; - late Business business; - PlatformFile? file; - late String qrCodedata; - int qrSize = 500; - bool _isUserSignedIn = false; - ScreenshotController screenshotController = ScreenshotController(); - Uint8List? businessQRImageFile; - - Future _checkUserSession() async { - final doesSessionExist = await SuperTokens.doesSessionExist(); - setState(() { - _isUserSignedIn = doesSessionExist; - }); - } - - String getQrCodeData(int qrSize) { - String color = MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark") - .toARGB32() - .toRadixString(16) - .substring(2, 8); - // KenLogger.warning(color); - String bgColor = MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark") - .toARGB32() - .toRadixString(16) - .substring(2, 8); - // KenLogger.warning(bgColor); - String encodedData = - Uri.encodeComponent("$qrCodedata${business.business_id}"); - - return "https://api.qrserver.com/v1/create-qr-code/?data=$encodedData&size=${qrSize}x${qrSize}&bgcolor=$bgColor&color=$color"; - } - - Future saveImage(Uint8List imageBytes) async { - final String filename = - "${business.Name}_QR_Code_${DateTime.now().millisecondsSinceEpoch}.png"; - if (kIsWeb) { - await FileSaver.instance.saveFile( - name: filename, - bytes: imageBytes, - fileExtension: "png", - mimeType: MimeType.png, - ); - } else if (defaultTargetPlatform == TargetPlatform.linux || - defaultTargetPlatform == TargetPlatform.windows) { - // Use File Picker to get a save path on Desktop - String? outputFile = await FilePicker.platform.saveFile( - dialogTitle: 'Please select where to save your QR Code:', - fileName: filename, - ); - - if (outputFile != null) { - final file = File(outputFile); - await file.writeAsBytes(imageBytes); - KenLogger.success("Saved to $outputFile"); - } - } else { - await FileSaver.instance.saveAs( - name: filename, - bytes: imageBytes, - fileExtension: "png", - mimeType: MimeType.png, - ); - } - } - - Future downloadQrCode() async { - if (_isUserSignedIn) { - await screenshotController.capture().then((image) { - // KenLogger.success("Image Captured: $image"); - setState(() { - businessQRImageFile = image; - }); - }).catchError((onError) { - KenLogger.error(onError); - }); - // KenLogger.success("QR Code Image Captured : $businessQRImageFile"); - saveImage(businessQRImageFile!); - } else { - showSignInRequiredAlert(); - } - } - - void showSignInRequiredAlert() { - showDialog( - barrierDismissible: false, - context: context, - builder: (context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - windowBody: Column( - children: [ - Icon( - MihIcons.mihLogo, - size: 100, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Text( - "Let's Get Started", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - Text( - "Ready to dive in to the world of MIH?\nSign in or create a free MIH account to unlock all the powerful features of the MIH app. It's quick and easy!", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 15, - ), - ), - const SizedBox(height: 25), - Center( - child: MihButton( - onPressed: () { - context.goNamed( - 'mihHome', - extra: true, - ); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Sign In/ Create Account", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ) - ], - ), - ); - }, - ); - } - - Widget displayBusinessQRCode(double profilePictureWidth) { - return Screenshot( - controller: screenshotController, - child: Material( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark") - .withValues(alpha: 0.6), - borderRadius: BorderRadius.circular(25), - elevation: 10, - shadowColor: Colors.black, - child: Container( - decoration: BoxDecoration( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(20), - ), - child: Padding( - padding: const EdgeInsets.all(20.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - FutureBuilder( - future: futureImageUrl, - builder: (context, asyncSnapshot) { - if (asyncSnapshot.connectionState == - ConnectionState.done && - asyncSnapshot.hasData) { - if (asyncSnapshot.requireData != "" || - asyncSnapshot.requireData.isNotEmpty) { - return MihCircleAvatar( - imageFile: CachedNetworkImageProvider( - asyncSnapshot.requireData), - width: profilePictureWidth, - expandable: true, - editable: false, - fileNameController: TextEditingController(), - userSelectedfile: file, - frameColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - backgroundColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onChange: () {}, - ); - } else { - return Icon( - MihIcons.iDontKnow, - size: profilePictureWidth, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ); - } - } else { - return Icon( - MihIcons.mihRing, - size: profilePictureWidth, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ); - } - }, - ), - FittedBox( - child: Text( - business.Name, - style: TextStyle( - fontSize: 35, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - FittedBox( - child: Text( - business.type, - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w600, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - const SizedBox(height: 5), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FittedBox( - child: Text( - "Powered by MIH", - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.w600, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - const SizedBox(width: 5), - Icon( - MihIcons.mihLogo, - size: 20, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ], - ), - const SizedBox(height: 10), - SizedBox( - width: 300, - height: 300, - child: CachedNetworkImage( - imageUrl: getQrCodeData(qrSize.toInt()), - placeholder: (context, url) => FittedBox( - child: const Mihloadingcircle(), - ), - errorWidget: (context, url, error) => - const Icon(Icons.error), - ), - ), - const SizedBox(height: 10), - FittedBox( - child: Text( - "Scan & Connect", - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - ], - )), - ), - ), - ); - } - - void shareMIHLink(BuildContext context, String message, String link) { - String shareText = "$message: $link"; - SharePlus.instance.share( - ShareParams(text: shareText), - ); - } - - @override - void dispose() { - super.dispose(); - } - - @override - void initState() { - super.initState(); - MzansiProfileProvider profileProvider = - context.read(); - if (widget.business != null) { - business = widget.business!; - } else { - business = profileProvider.business!; - } - _checkUserSession(); - futureImageUrl = MihFileApi.getMinioFileUrl(business.logo_path); - qrCodedata = - "${AppEnviroment.baseAppUrl}/business-profile/view?business_id="; - } - - @override - Widget build(BuildContext context) { - Size screenSize = MediaQuery.of(context).size; - return MihPackageToolBody( - borderOn: false, - innerHorizontalPadding: 10, - bodyItem: getBody(screenSize, context), - ); - } - - Widget getBody(Size screenSize, BuildContext context) { - double profilePictureWidth = 150; - return Stack( - alignment: Alignment.topCenter, - children: [ - MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 15.0), - child: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: screenSize.width * 0.2) - : EdgeInsets.symmetric( - horizontal: screenSize.width * 0), //.075), - child: Padding( - padding: const EdgeInsets.only(top: 10.0), - child: displayBusinessQRCode(profilePictureWidth), - ), - ), - ), - ), - Positioned( - right: 10, - bottom: 10, - child: MihFloatingMenu( - animatedIcon: AnimatedIcons.menu_close, - children: [ - SpeedDialChild( - child: Icon( - Icons.download_rounded, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Download QR Code", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - downloadQrCode(); - }, - ), - SpeedDialChild( - child: Icon( - Icons.share_rounded, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Share Business", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - shareMIHLink( - context, - "Check out ${business.Name} on the MIH app's Mzansi Directory", - "$qrCodedata${business.business_id}", - ); - }, - ), - ]), - ) - ], - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_reviews.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_reviews.dart deleted file mode 100644 index 66be859f..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_reviews.dart +++ /dev/null @@ -1,253 +0,0 @@ -import 'package:custom_rating_bar/custom_rating_bar.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business_review.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart'; -import 'package:provider/provider.dart'; - -class MihBusinessReviews extends StatefulWidget { - final Business? business; - const MihBusinessReviews({ - super.key, - required this.business, - }); - - @override - State createState() => _MihBusinessReviewsState(); -} - -class _MihBusinessReviewsState extends State { - late Business business; - - @override - void initState() { - super.initState(); - MzansiProfileProvider profileProvider = - context.read(); - if (widget.business != null) { - business = widget.business!; - } else { - business = profileProvider.business!; - } - } - - void onReviewTap(BusinessReview? businessReview, double width) { - // showDialog(context: context, builder: (context)=> ) - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return MihReviewBusinessWindow( - business: business, - businessReview: businessReview, - screenWidth: width, - readOnly: true, - onSuccessDismissPressed: () {}, - ); - }, - ); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return FutureBuilder( - future: MihMzansiDirectoryServices().getAllReviewsofBusiness( - business.business_id, - ), - builder: (context, asyncSnapshot) { - if (asyncSnapshot.connectionState == ConnectionState.waiting) { - return const Mihloadingcircle(); - } else if (asyncSnapshot.connectionState == ConnectionState.done && - asyncSnapshot.hasData) { - List reviews = asyncSnapshot.data!; - print("Reviews: ${reviews.length}"); - if (reviews.isEmpty) { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - // mainAxisAlignment: MainAxisAlignment.center, - // crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Stack( - alignment: AlignmentDirectional.center, - children: [ - Padding( - padding: const EdgeInsets.only(top: 10.0), - child: Icon( - MihIcons.mihRing, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - Icon( - Icons.star_rate_rounded, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ], - ), - const SizedBox(height: 10), - Text( - "No reviews yet, be the first the review ${business.Name}", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - // const SizedBox(height: 10), - // Center( - // child: RichText( - // textAlign: TextAlign.center, - // text: TextSpan( - // style: TextStyle( - // fontSize: 20, - // fontWeight: FontWeight.normal, - // color: MzansiInnovationHub.of(context)! - // .theme - // .secondaryColor(), - // ), - // children: [ - // TextSpan(text: "Press "), - // WidgetSpan( - // alignment: PlaceholderAlignment.middle, - // child: Icon( - // Icons.menu, - // size: 20, - // color: MzansiInnovationHub.of(context)! - // .theme - // .secondaryColor(), - // ), - // ), - // TextSpan(text: " to add your first loyalty card"), - // ], - // ), - // ), - // ), - ], - ), - ); - // return Column( - // children: [ - // const SizedBox(height: 50), - // Icon( - // Icons.star_rate_rounded, - // size: 150, - // color: - // MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - // Text( - // "No reviews yet, be the first the review\n${widget.business.Name}", - // textAlign: TextAlign.center, - // style: TextStyle( - // fontSize: 18, - // fontWeight: FontWeight.bold, - // ), - // ), - // ], - // ); - } else { - int descriptionDisplayCOunt = 75; - return ListView.separated( - itemCount: reviews.length, - separatorBuilder: (context, index) => Divider(), - itemBuilder: (context, index) { - return ListTile( - onTap: () { - onReviewTap(reviews[index], screenWidth); - }, - title: RatingBar.readOnly( - size: 25, - alignment: Alignment.centerLeft, - filledIcon: Icons.star, - emptyIcon: Icons.star_border, - halfFilledIcon: Icons.star_half, - filledColor: MihColors.getYellowColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - // MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - emptyColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - halfFilledColor: MihColors.getYellowColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - // MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // filledColor: - // MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // emptyColor: - // MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // halfFilledColor: - // MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - isHalfAllowed: true, - initialRating: double.parse(reviews[index].rating_score), - maxRating: 5, - ), - subtitle: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - // Text( - // "${reviews[index].reviewer} ", - // style: TextStyle( - // fontSize: 15, - // fontWeight: FontWeight.bold, - // ), - // ), - Text( - reviews[index].rating_title, - softWrap: true, - textAlign: TextAlign.left, - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - Visibility( - visible: reviews[index].rating_description.isNotEmpty, - child: Text( - reviews[index].rating_description.isEmpty - ? "" - : "${reviews[index].rating_description.substring(0, reviews[index].rating_description.length >= descriptionDisplayCOunt ? descriptionDisplayCOunt : reviews[index].rating_description.length - 1)}${reviews[index].rating_description.length >= descriptionDisplayCOunt ? "..." : ""}", - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.normal, - ), - ), - ), - Text( - "${reviews[index].date_time.split("T")[0]} ", - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.normal, - ), - ), - ], - ), - ); - }, - ); - } - } else { - return Center(child: Text('Error')); - } - }); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_user_search.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_user_search.dart deleted file mode 100644 index 024fe46b..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_user_search.dart +++ /dev/null @@ -1,203 +0,0 @@ -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/builders/build_user_list.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart'; -import 'package:provider/provider.dart'; - -class MihBusinessUserSearch extends StatefulWidget { - const MihBusinessUserSearch({ - super.key, - }); - - @override - State createState() => _MihBusinessUserSearchState(); -} - -class _MihBusinessUserSearchState extends State { - final TextEditingController searchController = TextEditingController(); - late Future> userSearchResults; - final FocusNode _searchFocusNode = FocusNode(); - bool hasSearchedBefore = false; - String userSearch = ""; - String errorCode = ""; - String errorBody = ""; - - Future> fetchUsers( - MzansiProfileProvider profileProvider, String search) async { - return MihUserServices().searchUsers(profileProvider, search, context); - } - - void submitUserForm(MzansiProfileProvider profileProvider) { - if (searchController.text != "") { - userSearch = searchController.text; - hasSearchedBefore = true; - userSearchResults = fetchUsers(profileProvider, userSearch); - } - } - - Widget displayUserList(MzansiProfileProvider profileProvider) { - if (profileProvider.userSearchResults.isNotEmpty) { - return Expanded(child: BuildUserList()); - } - if (hasSearchedBefore && userSearch.isNotEmpty) { - return Column( - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.iDontKnow, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "Let's try refining your search", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ], - ); - } else { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.personalProfile, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "Search for a member of Mzansi to add to your team", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - children: [ - TextSpan( - text: "You can search using their username or email"), - // WidgetSpan( - // alignment: PlaceholderAlignment.middle, - // child: Icon( - // Icons.menu, - // size: 20, - // color: MzansiInnovationHub.of(context)! - // .theme - // .secondaryColor(), - // ), - // ), - // TextSpan(text: " to add your first loyalty card"), - ], - ), - ), - ), - ], - ), - ); - } - // return Center( - // child: Text( - // "Enter Username or Email to search", - // style: TextStyle( - // fontSize: 25, - // color: MihColors.getGreyColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark")), - // textAlign: TextAlign.center, - // ), - // ); - } - - @override - void initState() { - super.initState(); - } - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - _searchFocusNode.dispose(); - } - - @override - Widget build(BuildContext context) { - final Size size = MediaQuery.sizeOf(context); - final double width = size.width; - return MihPackageToolBody( - borderOn: false, - innerHorizontalPadding: 10, - bodyItem: getBody(width), - ); - } - - Widget getBody(double width) { - // dscvds - return Consumer( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - Widget? child) { - return Column( - mainAxisSize: MainAxisSize.max, - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: MihSearchBar( - controller: searchController, - hintText: "Search Users", - prefixIcon: Icons.search, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - hintColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onPrefixIconTap: () { - submitUserForm(profileProvider); - }, - onClearIconTap: () { - setState(() { - searchController.clear(); - userSearch = ""; - }); - profileProvider.setUserearchResults(userSearchResults: []); - }, - searchFocusNode: _searchFocusNode, - ), - ), - const SizedBox(height: 10), - displayUserList(profileProvider), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_my_business_team.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_my_business_team.dart deleted file mode 100644 index 330a4db4..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_my_business_team.dart +++ /dev/null @@ -1,81 +0,0 @@ -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business_employee.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/builders/build_employee_list.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class MihMyBusinessTeam extends StatefulWidget { - const MihMyBusinessTeam({ - super.key, - }); - - @override - State createState() => _MihMyBusinessTeamState(); -} - -class _MihMyBusinessTeamState extends State { - String errorCode = ""; - String errorBody = ""; - - // void getEmployeeData(MzansiProfileProvider mzansiProfileProvider) { - // WidgetsBinding.instance.addPostFrameCallback((_) async { - // await MihBusinessEmployeeServices() - // .fetchEmployees(mzansiProfileProvider, context); - // }); - // } - - Widget displayEmployeeList(List employeeList) { - if (employeeList.isNotEmpty) { - return Expanded(child: BuildEmployeeList()); - } - return Center( - child: Text( - "", - style: TextStyle( - fontSize: 25, - color: MihColors.getGreyColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark")), - textAlign: TextAlign.center, - ), - ); - } - - @override - void initState() { - super.initState(); - // fetchEmployees(context.read()).catchError((e) { - // // Handle the error thrown in fetchEmployees - // print('Error fetching employees: $e'); - // }); - } - - @override - Widget build(BuildContext context) { - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(), - ); - } - - Widget getBody() { - return Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - if (mzansiProfileProvider.employeeList == null) { - return Center( - child: Mihloadingcircle(), - ); - } - return Column( - children: [ - displayEmployeeList(mzansiProfileProvider.employeeList!), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_my_business_user.dart b/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_my_business_user.dart deleted file mode 100644 index db4e2235..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_my_business_user.dart +++ /dev/null @@ -1,310 +0,0 @@ -import 'dart:ui'; - -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_image_display.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_update_my_business_user_details.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:provider/provider.dart'; - -class MihMyBusinessUser extends StatefulWidget { - const MihMyBusinessUser({ - super.key, - }); - - @override - State createState() => _MihMyBusinessUserState(); -} - -class _MihMyBusinessUserState extends State { - final fileNameController = TextEditingController(); - final signtureController = TextEditingController(); - PlatformFile? userPicFile; - PlatformFile? newSelectedSignaturePic; - - void editBizUserProfileWindow( - MzansiProfileProvider mzansiProfileProvider, double width) { - showDialog( - barrierDismissible: false, - context: context, - builder: (context) => MihUpdateMyBusinessUserDetails(), - ); - } - - String getDisplayText( - MzansiProfileProvider profileProvider, String originalText) { - int textLength = originalText.length >= 13 ? 13 : 6; - String displayText = ""; - if (profileProvider.hideBusinessUserDetails) { - for (int i = 0; i < textLength; i++) { - displayText += "●"; - } - } else { - displayText = originalText; - } - return displayText; - } - - Widget buildEmployeeInfoCard(MzansiProfileProvider profileProvider) { - TextStyle titleStyle = TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - TextStyle subtitleStyle = TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - TextStyle subtitleHeadingStyle = TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - return MihPackageWindow( - fullscreen: false, - windowTitle: "Employee Info Card", - onWindowTapClose: null, - backgroundColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - foregroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - windowBody: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "${profileProvider.user!.fname} ${profileProvider.user!.lname}", - style: titleStyle, - ), - RichText( - text: TextSpan( - children: [ - TextSpan( - text: "Title: ", - style: subtitleHeadingStyle, - ), - TextSpan( - text: profileProvider.businessUser!.title, - style: subtitleStyle, - ), - ], - ), - ), - RichText( - text: TextSpan( - children: [ - TextSpan( - text: "Access: ", - style: subtitleHeadingStyle, - ), - TextSpan( - text: getDisplayText(profileProvider, - profileProvider.businessUser!.access), - style: subtitleStyle, - ), - ], - ), - ), - ], - ), - ), - ], - ), - ], - ), - ); - } - - void setControllers() { - MzansiProfileProvider mzansiProfileProvider = - context.read(); - fileNameController.text = - mzansiProfileProvider.user!.pro_pic_path.split("/").last; - signtureController.text = - mzansiProfileProvider.businessUser!.sig_path.split("/").last; - } - - @override - void dispose() { - super.dispose(); - fileNameController.dispose(); - signtureController.dispose(); - userPicFile = null; - newSelectedSignaturePic = null; - } - - @override - void initState() { - super.initState(); - setControllers(); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - innerHorizontalPadding: 10, - bodyItem: getBody(screenWidth), - ); - } - - Widget getBody(double width) { - return Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - return Stack( - children: [ - MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: MzansiInnovationHub.of(context)!.theme.screenType == - "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0.075), - child: Column( - children: [ - Center( - child: Stack( - children: [ - MihCircleAvatar( - imageFile: mzansiProfileProvider.userProfilePicture, - width: 150, - expandable: true, - editable: false, - fileNameController: fileNameController, - userSelectedfile: userPicFile, - frameColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onChange: (_) {}, - ), - Positioned( - bottom: 5, - right: 5, - child: MihButton( - onPressed: () { - editBizUserProfileWindow( - mzansiProfileProvider, width); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 35, - height: 35, - child: Icon( - Icons.edit, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - ), - ], - ), - ), - const SizedBox(height: 20), - buildEmployeeInfoCard(mzansiProfileProvider), - const SizedBox(height: 10), - Container( - width: 300, - alignment: Alignment.topLeft, - child: const Text( - "Signature:", - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ), - Center( - child: mzansiProfileProvider.hideBusinessUserDetails - ? ClipRRect( - borderRadius: BorderRadius.circular(300 * 0.1), - child: ImageFiltered( - imageFilter: ImageFilter.blur( - sigmaX: 15.0, sigmaY: 15.0), - child: MihImageDisplay( - key: UniqueKey(), - imageFile: mzansiProfileProvider - .businessUserSignature, - width: 300, - height: 200, - editable: false, - fileNameController: signtureController, - userSelectedfile: newSelectedSignaturePic, - onChange: (selectedFile) {}, - ), - ), - ) - : MihImageDisplay( - key: UniqueKey(), - imageFile: - mzansiProfileProvider.businessUserSignature, - width: 300, - height: 200, - editable: false, - fileNameController: signtureController, - userSelectedfile: newSelectedSignaturePic, - onChange: (selectedFile) {}, - ), - ), - const SizedBox(height: 20), - ], - ), - ), - ), - Positioned( - right: 5, - top: 5, - child: MihButton( - width: 40, - height: 40, - onPressed: () { - mzansiProfileProvider.setHideBusinessUserDetails( - !mzansiProfileProvider.hideBusinessUserDetails); - }, - buttonColor: mzansiProfileProvider.hideBusinessUserDetails - ? MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark") - : MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Icon( - mzansiProfileProvider.hideBusinessUserDetails - ? Icons.visibility - : Icons.visibility_off, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/components/mih_edit_personal_profile_window.dart b/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/components/mih_edit_personal_profile_window.dart deleted file mode 100644 index 5fb60204..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/components/mih_edit_personal_profile_window.dart +++ /dev/null @@ -1,566 +0,0 @@ -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_toggle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:provider/provider.dart'; - -class MihEditPersonalProfileWindow extends StatefulWidget { - const MihEditPersonalProfileWindow({super.key}); - - @override - State createState() => - _MihEditPersonalProfileWindowState(); -} - -class _MihEditPersonalProfileWindowState - extends State { - TextEditingController proPicController = TextEditingController(); - TextEditingController usernameController = TextEditingController(); - TextEditingController fnameController = TextEditingController(); - TextEditingController lnameController = TextEditingController(); - TextEditingController purposeController = TextEditingController(); - bool _controllersInitialized = false; - final ValueNotifier _counter = ValueNotifier(0); - final _formKey = GlobalKey(); - PlatformFile? newSelectedProPic; - String oldProPicName = ""; - String env = ""; - bool businessUser = false; - - void initializeControllers(MzansiProfileProvider mzansiProfileProvider) { - businessUser = mzansiProfileProvider.user!.type == "business"; - oldProPicName = mzansiProfileProvider.user!.pro_pic_path.isNotEmpty - ? mzansiProfileProvider.user!.pro_pic_path.split("/").last - : ""; - env = AppEnviroment.getEnv() == "Prod" ? env = "Prod" : env = "Dev"; - if (!_controllersInitialized && mzansiProfileProvider.user != null) { - usernameController.text = mzansiProfileProvider.user!.username; - fnameController.text = mzansiProfileProvider.user!.fname; - lnameController.text = mzansiProfileProvider.user!.lname; - purposeController.text = mzansiProfileProvider.user!.purpose; - proPicController.text = - mzansiProfileProvider.user!.pro_pic_path.isNotEmpty - ? mzansiProfileProvider.user!.pro_pic_path.split("/").last - : ""; - businessUser = mzansiProfileProvider.user!.type == "business"; - _controllersInitialized = true; - } - } - - Future submitForm(MzansiProfileProvider mzansiProfileProvider) async { - if (mzansiProfileProvider.user!.username != usernameController.text) { - bool isUsernameUnique = await MihUserServices.isUsernameUnique( - usernameController.text, context); - if (isUsernameUnique == false) { - notUniqueAlert(); - return; - } - } - if (oldProPicName != proPicController.text) { - await uploadSelectedFile(mzansiProfileProvider, newSelectedProPic); - } - await updateUserApiCall(mzansiProfileProvider); - } - - Future updateUserApiCall( - MzansiProfileProvider mzansiProfileProvider) async { - KenLogger.success("businessUser: $businessUser"); - int responseCode = await MihUserServices().updateUserV2( - mzansiProfileProvider.user!, - fnameController.text, - lnameController.text, - usernameController.text, - proPicController.text, - purposeController.text, - businessUser, - context, - ); - if (responseCode == 200) { - setState(() { - setProfileVariables(mzansiProfileProvider); - newSelectedProPic = null; - }); - // if (originalProfileTypeIsBusiness == false && businessUser == true) { - // stayOnPersonalSide = false; - // } - String message = "Your information has been updated successfully!"; - successPopUp( - mzansiProfileProvider, - message, - ); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - Future uploadSelectedFile( - MzansiProfileProvider mzansiProfileProvider, PlatformFile? file) async { - var response = await MihFileApi.uploadFile( - mzansiProfileProvider.user!.app_id, - env, - "profile_files", - file, - context, - ); - if (response == 200) { - deleteFileApiCall(mzansiProfileProvider, oldProPicName); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - Future deleteFileApiCall( - MzansiProfileProvider mzansiProfileProvider, String filename) async { - var response = await MihFileApi.deleteFile( - mzansiProfileProvider.user!.app_id, - env, - "profile_files", - filename, - context, - ); - if (response == 200) { - //SQL delete - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - void setProfileVariables(MzansiProfileProvider mzansiProfileProvider) { - businessUser = mzansiProfileProvider.user!.type == "business"; - oldProPicName = mzansiProfileProvider.user!.pro_pic_path.isNotEmpty - ? mzansiProfileProvider.user!.pro_pic_path.split("/").last - : ""; - env = AppEnviroment.getEnv() == "Prod" ? env = "Prod" : env = "Dev"; - } - - Color getPurposeLimitColor(int limit) { - if (_counter.value <= limit) { - return MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } else { - return MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } - } - - void successPopUp( - MzansiProfileProvider profileProvider, - String message, - ) { - MihAlertServices().successAdvancedAlert( - "Successfully Updated Profile", - message, - [ - MihButton( - onPressed: () { - if (profileProvider.user!.type.toLowerCase() == "business" && - profileProvider.business == null) { - setupBusinessPopUp(profileProvider); - } else { - context.pop(); - context.pop(); - } - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - void setupBusinessPopUp( - MzansiProfileProvider profileProvider, - ) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - windowBody: Column( - children: [ - Icon( - MihIcons.businessSetup, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Text( - "Setup Business Profile?", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - Text( - "It looks like this is the first time activating your business account. Would you like to set up your business now or would you like to do it later?", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 15, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 25), - Center( - child: Wrap( - alignment: WrapAlignment.center, - runAlignment: WrapAlignment.center, - spacing: 10, - runSpacing: 10, - children: [ - MihButton( - onPressed: () { - context.pop(); - context.goNamed( - 'businessProfileSetup', - extra: profileProvider.user, - ); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - elevation: 10, - width: 300, - child: Text( - "Setup Business", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - context.pop(); - context.pop(); - context.pop(); - }, - buttonColor: MihColors.getOrangeColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - elevation: 10, - width: 300, - child: Text( - "Setup Later", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ) - ], - ), - ); - }, - ); - } - - void notUniqueAlert() { - MihAlertServices().errorBasicAlert( - "Too Slow, That Username is Taken", - "The username you have entered is already taken by another member of Mzansi. Please choose a different username and try again.", - context, - ); - } - - @override - void initState() { - super.initState(); - initializeControllers(context.read()); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - return MihPackageWindow( - fullscreen: false, - windowTitle: "Edit Profile", - onWindowTapClose: () { - Navigator.of(context).pop(); - }, - windowBody: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: screenWidth * 0.05) - : EdgeInsets.symmetric(horizontal: screenWidth * 0), - child: Stack( - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - MihForm( - formKey: _formKey, - formFields: [ - Center( - child: MihCircleAvatar( - imageFile: newSelectedProPic != null - ? MemoryImage(newSelectedProPic!.bytes!) - : mzansiProfileProvider.userProfilePicture, - width: 150, - expandable: false, - editable: true, - fileNameController: proPicController, - userSelectedfile: newSelectedProPic, - frameColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onChange: (selectedImage) { - setState(() { - newSelectedProPic = selectedImage; - }); - }, - ), - ), - // const SizedBox(height: 25.0), - Visibility( - visible: false, - child: MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: proPicController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Selected File Name", - ), - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: usernameController, - multiLineInput: false, - requiredText: true, - hintText: "Username", - validator: (value) { - return MihValidationServices() - .validateUsername(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: fnameController, - multiLineInput: false, - requiredText: true, - hintText: "First Name", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: lnameController, - multiLineInput: false, - requiredText: true, - hintText: "Last Name", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - height: 250, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: purposeController, - multiLineInput: true, - requiredText: true, - hintText: "Your Personal Mission", - validator: (value) { - return MihValidationServices() - .validateLength(purposeController.text, 256); - }, - ), - SizedBox( - height: 15, - child: ValueListenableBuilder( - valueListenable: _counter, - builder: (BuildContext context, int value, - Widget? child) { - return Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - "$value", - style: TextStyle( - color: getPurposeLimitColor(256), - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(width: 5), - Text( - "/256", - style: TextStyle( - color: getPurposeLimitColor(256), - fontWeight: FontWeight.bold, - ), - ), - ], - ); - }, - ), - ), - const SizedBox(height: 10.0), - MihToggle( - hintText: "Activate Business Account", - initialPostion: businessUser, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - secondaryFillColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onChange: (value) { - setState(() { - businessUser = value; - }); - KenLogger.success("Business User: $businessUser"); - }, - ), - const SizedBox(height: 30.0), - Center( - child: MihButton( - onPressed: () { - //Add validation here - if (_formKey.currentState!.validate()) { - submitForm(mzansiProfileProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - mzansiProfileProvider.user!.username.isEmpty - ? "Setup Profile" - : "Update", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ], - ), - Positioned( - right: 0, - top: 0, - child: MihButton( - onPressed: () { - //Add validation here - if (_formKey.currentState!.validate()) { - submitForm(mzansiProfileProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 100, - height: 25, - child: Text( - mzansiProfileProvider.user!.username.isEmpty - ? "Setup Profile" - : "Update", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 15, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/mzansi_profile.dart b/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/mzansi_profile.dart deleted file mode 100644 index f51b7947..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/mzansi_profile.dart +++ /dev/null @@ -1,122 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_settings.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_data_helper_services.dart'; -import 'package:provider/provider.dart'; - -class MzansiProfile extends StatefulWidget { - const MzansiProfile({ - super.key, - }); - - @override - State createState() => _MzansiProfileState(); -} - -class _MzansiProfileState extends State { - bool _isLoadingInitialData = true; - late final MihPersonalProfile _personalProfile; - late final MihPersonalSettings _personalSettings; - - Future _loadInitialData() async { - setState(() { - _isLoadingInitialData = true; - }); - MzansiProfileProvider mzansiProfileProvider = - context.read(); - if (mzansiProfileProvider.user == null) { - await MihDataHelperServices().loadUserDataWithBusinessesData( - mzansiProfileProvider, - ); - } - setState(() { - _isLoadingInitialData = false; - }); - } - - @override - void initState() { - super.initState(); - _personalProfile = const MihPersonalProfile(); - _personalSettings = const MihPersonalSettings(); - _loadInitialData(); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - Widget? child) { - if (_isLoadingInitialData) { - return Scaffold( - body: Center( - child: Mihloadingcircle(), - ), - ); - } - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: getToolTitle(), - selectedbodyIndex: profileProvider.personalIndex, - onIndexChange: (newIndex) { - profileProvider.setPersonalIndex(newIndex); - }, - ); - }, - ); - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - // Navigator.of(context).pop(); - context.goNamed( - 'mihHome', - ); - FocusScope.of(context).unfocus(); - }, - ); - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.person)] = () { - context.read().setPersonalIndex(0); - }; - // temp[const Icon(Icons.person)] = () { - // context.read().setPersonalIndex(1); - // }; - temp[const Icon(Icons.settings)] = () { - context.read().setPersonalIndex(1); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: context.watch().personalIndex, - ); - } - - List getToolBody() { - return [ - _personalProfile, - _personalSettings, - ]; - } - - List getToolTitle() { - List toolTitles = [ - "Profile", - "Settings", - ]; - return toolTitles; - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/mzansi_profile_view.dart b/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/mzansi_profile_view.dart deleted file mode 100644 index e58de9e8..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/mzansi_profile_view.dart +++ /dev/null @@ -1,79 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile_view.dart'; -import 'package:flutter/material.dart'; - -class MzansiProfileView extends StatefulWidget { - const MzansiProfileView({ - super.key, - }); - - @override - State createState() => _MzansiProfileViewState(); -} - -class _MzansiProfileViewState extends State { - int _selcetedIndex = 0; - late final MihPersonalProfileView _personalProfileView; - - @override - void initState() { - super.initState(); - _personalProfileView = MihPersonalProfileView(); - } - - @override - Widget build(BuildContext context) { - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: getToolTitle(), - selectedbodyIndex: _selcetedIndex, - onIndexChange: (newValue) { - setState(() { - _selcetedIndex = newValue; - }); - }, - ); - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - context.pop(); - FocusScope.of(context).unfocus(); - }, - ); - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.person)] = () { - setState(() { - _selcetedIndex = 0; - }); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: _selcetedIndex, - ); - } - - List getToolBody() { - return [ - _personalProfileView, - ]; - } - - List getToolTitle() { - List toolTitles = [ - "Profile", - ]; - return toolTitles; - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/package_tiles/mzansi_profile_tile.dart b/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/package_tiles/mzansi_profile_tile.dart deleted file mode 100644 index 7fd9045a..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/package_tiles/mzansi_profile_tile.dart +++ /dev/null @@ -1,42 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MzansiProfileTile extends StatefulWidget { - final double packageSize; - - const MzansiProfileTile({ - super.key, - required this.packageSize, - }); - - @override - State createState() => _MzansiProfileTileState(); -} - -class _MzansiProfileTileState extends State { - @override - Widget build(BuildContext context) { - // ImageProvider logo = MzansiInnovationHub.of(context)!.theme.logoImage(); - return MihPackageTile( - onTap: () { - context.goNamed( - 'mzansiProfileManage', - ); - }, - appName: "Mzansi Profile", - appIcon: Icon( - MihIcons.mihLogo, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // size: widget.packageSize, - ), - iconSize: widget.packageSize, - textColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/package_tiles/mzansi_setup_profile_tile.dart b/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/package_tiles/mzansi_setup_profile_tile.dart deleted file mode 100644 index 678b5299..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/package_tiles/mzansi_setup_profile_tile.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MzansiSetupProfileTile extends StatefulWidget { - final double packageSize; - - const MzansiSetupProfileTile({ - super.key, - required this.packageSize, - }); - - @override - State createState() => _MzansiSetupProfileTileState(); -} - -class _MzansiSetupProfileTileState extends State { - @override - Widget build(BuildContext context) { - return MihPackageTile( - onTap: () { - context.goNamed( - 'mzansiProfileManage', - ); - }, - appName: "Set Up Profile", - appIcon: Icon( - MihIcons.profileSetup, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // size: widget.packageSize, - ), - iconSize: widget.packageSize, - textColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile.dart b/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile.dart deleted file mode 100644 index 622a3adc..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile.dart +++ /dev/null @@ -1,303 +0,0 @@ -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/profile_link.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -// import 'package:mzansi_innovation_hub/mih_package_components/mih_profile_links.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/personal_profile/components/mih_edit_personal_profile_window.dart'; -import 'package:provider/provider.dart'; - -class MihPersonalProfile extends StatefulWidget { - const MihPersonalProfile({super.key}); - - @override - State createState() => _MihPersonalProfileState(); -} - -class _MihPersonalProfileState extends State { - TextEditingController proPicController = TextEditingController(); - PlatformFile? newSelectedProPic; - - void editProfileWindow(double width) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - return MihEditPersonalProfileWindow(); - }, - ), - ); - } - - List getTempLinks() { - return [ - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Youtube", - web_link: "https://www.youtube.com/@MzansiInnovationHub", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Threads", - web_link: "https://www.threads.com/@mzansi.innovation.hub", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "TikTok", - web_link: "https://www.tiktok.com/@mzansiinnovationhub", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "WhatsApp", - web_link: "https://whatsapp.com/channel/0029Vax3INCIyPtMn8KgeM2F", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Twitch", - web_link: "https://www.twitch.tv/mzansiinnovationhub", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Instagram", - web_link: "https://www.instagram.com/mzansi.innovation.hub/", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "X", - web_link: "https://x.com/mzansi_inno_hub", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "LinkedIn", - web_link: "https://www.linkedin.com/in/yasien-meth-172352108/", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Facebook", - web_link: "https://www.facebook.com/profile.php?id=61565345762136", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Reddit", - web_link: "https://www.reddit.com/r/Mzani_Innovation_Hub/", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "Discord", - web_link: "https://discord.gg/ZtTZYd5d", - ), - ProfileLink( - idprofile_links: 1, - app_id: "1234", - business_id: "", - destination: "My App", - web_link: "https://app.mzansi-innovation-hub.co.za/about", - ), - ]; - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(screenWidth), - ); - } - - Widget getBody(double width) { - return Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - if (mzansiProfileProvider.user == null) { - //Change to new user flow - return Center( - child: Mihloadingcircle(), - ); - } else { - return MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0.075), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Stack( - children: [ - MihCircleAvatar( - imageFile: mzansiProfileProvider.userProfilePicture, - width: 150, - expandable: true, - editable: false, - fileNameController: proPicController, - userSelectedfile: newSelectedProPic, - frameColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onChange: (selectedImage) { - setState(() { - newSelectedProPic = selectedImage; - }); - }, - key: ValueKey(mzansiProfileProvider.userProfilePicUrl), - ), - Positioned( - bottom: 5, - right: 5, - child: MihButton( - onPressed: () { - editProfileWindow(width); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 35, - height: 35, - child: Icon( - Icons.edit, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - ], - ), - const SizedBox(height: 10.0), - FittedBox( - child: Text( - mzansiProfileProvider.user!.username.isNotEmpty - ? mzansiProfileProvider.user!.username - : "username", - style: TextStyle( - fontSize: 35, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - FittedBox( - child: Text( - mzansiProfileProvider.user!.fname.isNotEmpty - ? "${mzansiProfileProvider.user!.fname} ${mzansiProfileProvider.user!.lname}" - : "Name Surname", - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - FittedBox( - child: Text( - mzansiProfileProvider.user!.type == "business" - ? "Business".toUpperCase() - : "Personal".toUpperCase(), - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - const SizedBox(height: 10.0), - Center( - child: SizedBox( - width: 700, - child: Text( - mzansiProfileProvider.user!.purpose.isNotEmpty - ? mzansiProfileProvider.user!.purpose - : "", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - ), - const SizedBox(height: 15.0), - // Stack( - // children: [ - // MihProfileLinks( - // // links: mzansiProfileProvider.personalLinks, - // links: getTempLinks(), - // buttonSize: 80, - // paddingOn: false, - // ), - // Positioned( - // top: 5, - // left: 5, - // child: MihButton( - // onPressed: () { - // editProfileWindow(width); - // }, - // buttonColor: MihColors.getGreenColor( - // MzansiInnovationHub.of(context)!.theme.mode == - // "Dark"), - // width: 35, - // height: 35, - // child: Icon( - // Icons.link, - // color: MihColors.getPrimaryColor( - // MzansiInnovationHub.of(context)!.theme.mode == - // "Dark"), - // ), - // ), - // ), - // ], - // ), - ], - ), - ), - ); - } - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile_view.dart b/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile_view.dart deleted file mode 100644 index 1b39d6fa..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_profile_view.dart +++ /dev/null @@ -1,175 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class MihPersonalProfileView extends StatefulWidget { - const MihPersonalProfileView({ - super.key, - }); - - @override - State createState() => _MihPersonalProfileViewState(); -} - -class _MihPersonalProfileViewState extends State { - late Future futureImageUrl; - PlatformFile? file; - - @override - void dispose() { - super.dispose(); - } - - @override - void initState() { - super.initState(); - MzansiDirectoryProvider directoryProvider = - context.read(); - futureImageUrl = MihFileApi.getMinioFileUrl( - directoryProvider.selectedUser!.pro_pic_path); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - innerHorizontalPadding: 10, - bodyItem: getBody(screenWidth), - ); - } - - Widget getBody(double width) { - double profilePictureWidth = 150; - return Consumer( - builder: (BuildContext context, MzansiDirectoryProvider directoryProvider, - Widget? child) { - return MihSingleChildScroll( - scrollbarOn: true, - child: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0.075), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - FutureBuilder( - future: futureImageUrl, - builder: (context, asyncSnapshot) { - if (asyncSnapshot.connectionState == - ConnectionState.done && - asyncSnapshot.hasData) { - if (asyncSnapshot.requireData != "") { - return MihCircleAvatar( - imageFile: CachedNetworkImageProvider( - asyncSnapshot.requireData), - width: profilePictureWidth, - expandable: true, - editable: false, - fileNameController: TextEditingController(), - userSelectedfile: file, - frameColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onChange: () {}, - ); - } else { - return Icon( - MihIcons.iDontKnow, - size: profilePictureWidth, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ); - } - } else { - return Icon( - MihIcons.mihRing, - size: profilePictureWidth, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ); - } - }), - FittedBox( - child: Text( - directoryProvider.selectedUser!.username.isNotEmpty - ? directoryProvider.selectedUser!.username - : "Username", - style: TextStyle( - fontSize: 35, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - FittedBox( - child: Text( - directoryProvider.selectedUser!.fname.isNotEmpty - ? "${directoryProvider.selectedUser!.fname} ${directoryProvider.selectedUser!.lname}" - : "Name Surname", - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - FittedBox( - child: Text( - directoryProvider.selectedUser!.type.toUpperCase(), - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - const SizedBox(height: 10.0), - Center( - child: SizedBox( - width: 700, - child: Text( - directoryProvider.selectedUser!.purpose.isNotEmpty - ? directoryProvider.selectedUser!.purpose - : "No Personal Mission added yet", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - ), - const SizedBox(height: 30.0), - ], - ), - ), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_settings.dart b/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_settings.dart deleted file mode 100644 index aff6f1b3..00000000 --- a/mih_ui/lib/mih_packages/mzansi_profile/personal_profile/package_tools/mih_personal_settings.dart +++ /dev/null @@ -1,128 +0,0 @@ -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:provider/provider.dart'; - -class MihPersonalSettings extends StatefulWidget { - const MihPersonalSettings({ - super.key, - }); - - @override - State createState() => _MihPersonalSettingsState(); -} - -class _MihPersonalSettingsState extends State { - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, Widget? child) { - return MihPackageToolBody( - borderOn: false, - innerHorizontalPadding: 10, - bodyItem: getBody(mzansiProfileProvider), - ); - }, - ); - } - - void deleteAccountPopUp( - MzansiProfileProvider mzansiProfileProvider, BuildContext ctxtd) { - MihAlertServices().errorAdvancedAlert( - "Are you sure you want to permanently delete your MIH account?", - "This action will remove all of your data, and it cannot be recovered. We understand this is a big decision, so please take a moment to double-check.\n\nIf you're certain, please confirm below. If you've changed your mind, you can simply close this window.", - [ - MihButton( - onPressed: () { - MihUserServices.deleteAccount(mzansiProfileProvider, context); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Delete", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - Navigator.pop(context); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Cancel", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ctxtd, - ); - } - - Widget getBody(MzansiProfileProvider mzansiProfileProvider) { - return MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Center( - child: FaIcon( - FontAwesomeIcons.trashCan, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - size: 150, - ), - ), - const SizedBox(height: 10.0), - Text( - "Would you like to delete your MIH account?", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 10.0), - MihButton( - onPressed: () { - deleteAccountPopUp(mzansiProfileProvider, context); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Delete Account", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_wallet/builder/build_loyalty_card_list.dart b/mih_ui/lib/mih_packages/mzansi_wallet/builder/build_loyalty_card_list.dart deleted file mode 100644 index b75bb179..00000000 --- a/mih_ui/lib/mih_packages/mzansi_wallet/builder/build_loyalty_card_list.dart +++ /dev/null @@ -1,842 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_banner_ad.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_wallet_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_wallet_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_objects/loyalty_card.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_card_display.dart'; -import 'package:flutter/material.dart'; -import 'package:barcode_widget/barcode_widget.dart'; -import 'package:provider/provider.dart'; -import 'package:screen_brightness/screen_brightness.dart'; - -class BuildLoyaltyCardList extends StatefulWidget { - final List cardList; - final int navIndex; - final bool favouritesMode; - final TextEditingController searchText; - - const BuildLoyaltyCardList({ - super.key, - required this.cardList, - required this.navIndex, - required this.favouritesMode, - required this.searchText, - }); - - @override - State createState() => _BuildLoyaltyCardListState(); -} - -class _BuildLoyaltyCardListState extends State { - final TextEditingController _nicknameController = TextEditingController(); - final TextEditingController _cardNumberController = TextEditingController(); - late int _noFavourites; - double? _originalBrightness; - final _formKey = GlobalKey(); - - void openscanner() async { - context.pushNamed( - "barcodeScanner", - extra: _cardNumberController, - ); - } - - void editCardWindow( - MzansiProfileProvider mzansiProfileProvider, - MzansiWalletProvider walletProvider, - BuildContext ctxt, - int index, - double width) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: "Edit Loyalty Card", - onWindowTapClose: () { - _cardNumberController.clear(); - _nicknameController.clear(); - Navigator.pop(context); - }, - windowBody: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.05) - : EdgeInsets.symmetric(horizontal: width * 0), - child: Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: _nicknameController, - multiLineInput: false, - requiredText: false, - hintText: "Card Title", - ), - const SizedBox(height: 10), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.max, - children: [ - Flexible( - child: MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: _cardNumberController, - multiLineInput: false, - requiredText: true, - hintText: "Card Number", - numberMode: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - ), - const SizedBox(width: 20), - MihButton( - onPressed: () { - openscanner(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 100, - child: Text( - "Scan", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - const SizedBox(height: 15), - Center( - child: MihButton( - onPressed: () async { - if (_formKey.currentState!.validate()) { - int statusCode = await MIHMzansiWalletApis - .updateLoyaltyCardAPICall( - walletProvider, - mzansiProfileProvider.user!, - widget.cardList[index].idloyalty_cards, - widget.cardList[index].shop_name, - widget.cardList[index].favourite, - widget.cardList[index].priority_index, - _nicknameController.text, - _cardNumberController.text, - ctxt, - ); - if (statusCode == 200) { - context.pop(); - context.pop(); - MihAlertServices().successBasicAlert( - "Success!", - "You have successfully updated the loyalty card details.", - context, - ); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Update", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ], - ), - ), - ), - ); - } - - void deleteCardWindow(MzansiProfileProvider mzansiProfileProvider, - MzansiWalletProvider walletProvider, BuildContext ctxt, int index) { - MihAlertServices().deleteConfirmationAlert( - "This Card will be deleted permanently from your Mzansi Wallet. Are you certain you want to delete it?", - () async { - int statusCode = await MIHMzansiWalletApis.deleteLoyaltyCardAPICall( - walletProvider, - mzansiProfileProvider.user!, - widget.cardList[index].idloyalty_cards, - context, - ); - if (statusCode == 200) { - context.pop(); - context.pop(); - MihAlertServices().successBasicAlert( - "Success!", - "You have successfully deleted the loyalty card from your Mzansi Wallet.", - context, - ); - } else { - context.pop(); - MihAlertServices().internetConnectionAlert(context); - } - }, - context, - ); - } - - void addToFavCardWindow(MzansiProfileProvider mzansiProfileProvider, - MzansiWalletProvider walletProvider, BuildContext ctxt, int index) { - MihAlertServices().warningAdvancedAlert( - // "Card Added to Favourites", - "Add Card to Favourites?", - "Would you like to add this card to your favourites for quick access?", - // "You have successfully added the loyalty card to your favourites.", - [ - MihButton( - onPressed: () async { - context.pop(); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Cancel", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () async { - int statusCode = await MIHMzansiWalletApis.updateLoyaltyCardAPICall( - walletProvider, - mzansiProfileProvider.user!, - widget.cardList[index].idloyalty_cards, - widget.cardList[index].shop_name, - "Yes", - _noFavourites, - widget.cardList[index].nickname, - widget.cardList[index].card_number, - ctxt, - ); - if (statusCode == 200) { - context.pop(); - context.pop(); - await MIHMzansiWalletApis.getFavouriteLoyaltyCards( - walletProvider, - mzansiProfileProvider.user!.app_id, - context, - ); - context.read().setToolIndex(1); - MihAlertServices().successBasicAlert( - "Success!", - "You have successfully added the loyalty card to your favourites.", - context, - ); - } else { - MihAlertServices().internetConnectionAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Add", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - void removeFromFavCardWindow(MzansiProfileProvider mzansiProfileProvider, - MzansiWalletProvider walletProvider, BuildContext ctxt, int index) { - MihAlertServices().warningAdvancedAlert( - "Remove From Favourites?", - "Are you sure you want to remove this card from your favourites?", - [ - MihButton( - onPressed: () async { - int statusCode = await MIHMzansiWalletApis.updateLoyaltyCardAPICall( - walletProvider, - mzansiProfileProvider.user!, - widget.cardList[index].idloyalty_cards, - widget.cardList[index].shop_name, - "", - 0, - widget.cardList[index].nickname, - widget.cardList[index].card_number, - ctxt, - ); - if (statusCode == 200) { - context.pop(); - context.pop(); - await MIHMzansiWalletApis.getFavouriteLoyaltyCards( - walletProvider, - mzansiProfileProvider.user!.app_id, - context, - ); - context.read().setToolIndex(0); - MihAlertServices().successBasicAlert( - "Success!", - "You have successfully removed the loyalty card to your favourites.", - context, - ); - } else { - MihAlertServices().internetConnectionAlert(context); - } - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Remove", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () async { - context.pop(); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Cancel", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ctxt, - ); - } - - void viewCardWindow(MzansiProfileProvider mzansiProfileProvider, - MzansiWalletProvider walletProvider, int index, double width) { - //print(widget.cardList[index].card_number); - String formattedCardNumber = ""; - for (int i = 0; i <= widget.cardList[index].card_number.length - 1; i++) { - formattedCardNumber += widget.cardList[index].card_number[i]; - if ((i + 1) % 4 == 0) { - formattedCardNumber += "\t"; - } - } - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: widget.cardList[index].shop_name.toUpperCase(), - menuOptions: [ - SpeedDialChild( - child: widget.cardList[index].favourite == "" - ? Icon( - Icons.favorite, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ) - : Icon( - Icons.favorite_border, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: widget.cardList[index].favourite == "" - ? "Add to Favourite" - : "Remove from Favourite", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - if (widget.cardList[index].favourite == "") { - addToFavCardWindow( - mzansiProfileProvider, - walletProvider, - context, - index, - ); - } else { - removeFromFavCardWindow( - mzansiProfileProvider, - walletProvider, - context, - index, - ); - } - }, - ), - SpeedDialChild( - child: Icon( - Icons.edit, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Edit Card Details", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - setState(() { - _cardNumberController.text = widget.cardList[index].card_number; - _nicknameController.text = widget.cardList[index].nickname; - }); - editCardWindow( - mzansiProfileProvider, - walletProvider, - context, - index, - width, - ); - }, - ), - SpeedDialChild( - child: Icon( - Icons.delete, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Delete Card", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - deleteCardWindow( - mzansiProfileProvider, - walletProvider, - context, - index, - ); - }, - ), - ], - onWindowTapClose: () { - resetScreenBrightness(); - context.pop(); - }, - windowBody: Column( - mainAxisSize: MainAxisSize.max, - children: [ - Container( - width: 500, - child: MihCardDisplay( - shopName: widget.cardList[index].shop_name, - nickname: widget.cardList[index].nickname, - height: 250, - ), - ), - const SizedBox(height: 20), - Container( - width: 500, - //color: Colors.white, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - ), - child: Column( - children: [ - // const SizedBox(height: 10), - Padding( - padding: const EdgeInsets.all(10.0), - child: SizedBox( - height: 75, - // width: 300, - child: BarcodeWidget( - //color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - barcode: Barcode.code128(), - backgroundColor: Colors.white, - data: widget.cardList[index].card_number, - drawText: false, - ), - // SfBarcodeGenerator( - // backgroundColor: Colors.white, - // barColor: Colors.black, - // value: widget.cardList[index].card_number, - // symbology: Code128(), - // //showValue: true, - // ), - ), - ), - // const SizedBox(height: 10), - Text( - formattedCardNumber, - textAlign: TextAlign.center, - style: const TextStyle( - color: Colors.black, - fontSize: 25, - fontWeight: FontWeight.bold - //MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ], - ), - ), - SizedBox(height: 10), - if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) MihBannerAd() - // MihBannerAd(), - ], - ), - ), - ); - } - - double getHorizontalPaddingSize(Size screenSize) { - if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") { - return screenSize.width / 10; - } else { - return 20; - } - } - - int countFavourites() { - int count = 0; - for (var card in widget.cardList) { - if (card.favourite != "") { - count++; - } - } - return count; - } - - Future setScreenBrightness(double newBrightness) async { - if (!kIsWeb && !Platform.isLinux) { - bool canChange = - await ScreenBrightness.instance.canChangeSystemBrightness; - - KenLogger.success("Can change system brightness: $canChange"); - if (canChange) { - // Permission is granted, you can now change the system brightness - await ScreenBrightness.instance.system.then((brightness) { - setState(() { - _originalBrightness = brightness; - }); - KenLogger.success("Original brightness: $_originalBrightness"); - }); - await ScreenBrightness.instance - .setSystemScreenBrightness(newBrightness); - KenLogger.success("Brightness set to: $newBrightness"); - } else { - context.pop(); - MihAlertServices().errorAdvancedAlert( - "Permission Required", - "Sometimes it can be tough to scan your loyalty card if your phone screen is dim. To make sure your scan is successful every time, we need your permission to temporarily increase your screen brightness.\n\nWould you mind enabling this in your device settings?", - [ - MihButton( - onPressed: () async { - context.pop(); - await ScreenBrightness.instance - .setSystemScreenBrightness(newBrightness); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Grant Permission", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - } else { - KenLogger.warning( - "Screen brightness adjustment is not supported on Web."); - // _originalBrightness = 1.0; // Default brightness for web - // await ScreenBrightness.instance.setSystemScreenBrightness(1.0); - // KenLogger.success("Brightness set to default value: 1.0"); - } - } - - void resetScreenBrightness() async { - if (!kIsWeb) { - KenLogger.success( - "Resetting screen brightness to original value: $_originalBrightness"); - if (_originalBrightness != null) { - await ScreenBrightness.instance - .setSystemScreenBrightness(_originalBrightness!); - } - } else { - KenLogger.warning("Screen brightness reset is not supported on Web."); - } - } - - @override - void initState() { - super.initState(); - setState(() { - _noFavourites = countFavourites(); - }); - } - - @override - Widget build(BuildContext context) { - final Size size = MediaQuery.sizeOf(context); - // final double width = size.width; - //final double height = size.height; - if (widget.cardList.isNotEmpty) { - return Consumer2( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, - MzansiWalletProvider walletProvider, - Widget? child) { - return GridView.builder( - padding: EdgeInsets.only( - left: getHorizontalPaddingSize(size), - right: getHorizontalPaddingSize(size), - ), - itemCount: widget.cardList.length, - gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent( - mainAxisSpacing: 0, - crossAxisSpacing: 5, - maxCrossAxisExtent: 200, - ), - itemBuilder: (context, index) { - return GestureDetector( - child: MihCardDisplay( - shopName: widget.cardList[index].shop_name, - nickname: widget.cardList[index].nickname, - height: 100, - ), - onTap: () { - setScreenBrightness(1.0); - viewCardWindow( - mzansiProfileProvider, - walletProvider, - index, - size.width, - ); - }, - ); - }, - ); - }, - ); - } else { - if (!widget.favouritesMode) { - if (widget.searchText.text.isNotEmpty) { - return Column( - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.iDontKnow, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "Let's try refining your search", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ], - ); - } - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.mzansiWallet, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "No cards added to your Mzansi Wallet", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - Icons.menu, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - TextSpan(text: " to add your first loyalty card"), - ], - ), - ), - ), - ], - ), - ); - } else { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.mzansiWallet, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "No favourite cards in your Mzansi Wallet", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - Icons.menu, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - TextSpan( - text: - " when viewing a loyalty card to add it to your favorites"), - ], - ), - ), - ), - ], - ), - ); - } - } - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_wallet/components/mih_add_card_window.dart b/mih_ui/lib/mih_packages/mzansi_wallet/components/mih_add_card_window.dart deleted file mode 100644 index d006947a..00000000 --- a/mih_ui/lib/mih_packages/mzansi_wallet/components/mih_add_card_window.dart +++ /dev/null @@ -1,294 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_wallet_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_card_display.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_wallet_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:provider/provider.dart'; - -class MihAddCardWindow extends StatefulWidget { - const MihAddCardWindow({ - super.key, - }); - - @override - State createState() => _MihAddCardWindowState(); -} - -class _MihAddCardWindowState extends State { - final _formKey = GlobalKey(); - final TextEditingController _cardNumberController = TextEditingController(); - final TextEditingController _shopController = TextEditingController(); - final TextEditingController _nicknameController = TextEditingController(); - final ValueNotifier _shopName = ValueNotifier(""); - - void successPopUp(String title, String message, int packageIndex) { - MihAlertServices().successBasicAlert( - title, - message, - context, - ); - } - - @override - void dispose() { - _cardNumberController.dispose(); - _shopController.dispose(); - _nicknameController.dispose(); - _shopName.dispose(); - super.dispose(); - } - - @override - void initState() { - super.initState(); - _shopController.addListener(_shopSelected); - } - - void _shopSelected() { - if (_shopController.text.isNotEmpty) { - _shopName.value = _shopController.text; - } else { - _shopName.value = ""; - } - } - - @override - Widget build(BuildContext context) { - final double width = MediaQuery.sizeOf(context).width; - return MihPackageWindow( - fullscreen: false, - windowTitle: "Add New Loyalty Card", - onWindowTapClose: () { - _shopController.clear(); - _cardNumberController.clear(); - _nicknameController.clear(); - _shopName.value = ""; - Navigator.pop(context); - }, - windowBody: Padding( - padding: MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.05) - : EdgeInsets.symmetric(horizontal: width * 0), - child: Consumer2( - builder: (BuildContext context, - MzansiProfileProvider mzansiProfileProvider, - MzansiWalletProvider walletProvider, - Widget? child) { - return Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - MihDropdownField( - controller: _shopController, - hintText: "Shop Name", - editable: true, - enableSearch: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - requiredText: true, - dropdownOptions: const [ - "+More", - "Apple Tree", - "Auchan", - "Best Before", - "Big Save", - "Boxer", - "BP", - "Builders Warehouse", - "Checkers", - "Choppies", - "Clicks", - "Continente", - "Cotton:On", - "Carrefour", - "Dis-Chem", - "Edgars", - "Engen", - "Eskom", - "Exclusive Books", - "Fresh Stop", - "Fresmart", - "Infinity", - "Jet", - "Justrite", - "Kero", - "Leroy Merlin", - "Makro", - "Naivas", - "OK Foods", - "Panarottis", - "Pick n Pay", - "PnA", - "PQ Clothing", - "Rage", - "Sefalana", - "Sasol", - "Shell", - "Shoprite", - "Signature Cosmetics & Fragrances", - "Spar", - "Spur", - "TFG Group", - "Total Energies", - "Toys R Us", - "Woermann Brock", - "Woolworths", - ], - ), - ValueListenableBuilder( - valueListenable: _shopName, - builder: - (BuildContext context, String value, Widget? child) { - return Visibility( - visible: value != "", - child: Column( - children: [ - const SizedBox(height: 10), - MihCardDisplay( - shopName: _shopName.value, - nickname: "", - height: 200), - ], - ), - ); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: _nicknameController, - multiLineInput: false, - requiredText: false, - hintText: "Card Title", - ), - const SizedBox(height: 10), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.max, - children: [ - Flexible( - child: MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: _cardNumberController, - multiLineInput: false, - requiredText: true, - hintText: "Card Number", - numberMode: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - ), - const SizedBox(width: 20), - MihButton( - onPressed: () { - context.pushNamed( - "barcodeScanner", - extra: - _cardNumberController, // Use local controller - ); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 100, - child: Text( - "Scan", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - const SizedBox(height: 15), - Center( - child: MihButton( - onPressed: () async { - if (_formKey.currentState!.validate()) { - if (_shopController.text == "") { - MihAlertServices().inputErrorAlert(context); - } else { - int statusCode = await MIHMzansiWalletApis - .addLoyaltyCardAPICall( - walletProvider, - mzansiProfileProvider.user!, - mzansiProfileProvider.user!.app_id, - _shopController.text, - _cardNumberController.text, - "", - 0, - _nicknameController.text, - context, - ); - if (statusCode == 201) { - context.pop(); - KenLogger.success("Card Added Successfully"); - successPopUp( - "Successfully Added Card", - "The loyalty card has been added to your favourites.", - 0, - ); - } else { - MihAlertServices() - .internetConnectionAlert(context); - } - } - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Add", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ], - ); - }, - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_wallet/components/mih_barcode_scanner.dart b/mih_ui/lib/mih_packages/mzansi_wallet/components/mih_barcode_scanner.dart deleted file mode 100644 index e889cd29..00000000 --- a/mih_ui/lib/mih_packages/mzansi_wallet/components/mih_barcode_scanner.dart +++ /dev/null @@ -1,175 +0,0 @@ -import 'dart:async'; -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mobile_scanner/mobile_scanner.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihBarcodeScanner extends StatefulWidget { - final TextEditingController cardNumberController; - const MihBarcodeScanner({ - super.key, - required this.cardNumberController, - }); - - @override - State createState() => _MihBarcodeScannerState(); -} - -class _MihBarcodeScannerState extends State - with WidgetsBindingObserver { - final MobileScannerController _scannerController = MobileScannerController( - detectionSpeed: DetectionSpeed.normal, - ); - StreamSubscription? _subscription; - bool _isScannerStarting = false; - bool barcodeScanned = false; - - Future foundCode(BarcodeCapture bcode) async { - if (mounted && - barcodeScanned == false && - bcode.barcodes.isNotEmpty && - bcode.barcodes.first.rawValue != null) { - setState(() { - barcodeScanned = true; - widget.cardNumberController.text = bcode.barcodes.first.rawValue!; - }); - print(bcode.barcodes.first.rawValue); - await _scannerController.stop(); - if (mounted) { - context.pop(); - } - } - } - - @override - void didChangeAppLifecycleState(AppLifecycleState state) { - if (!_scannerController.value.hasCameraPermission) { - return; - } - switch (state) { - case AppLifecycleState.detached: - case AppLifecycleState.hidden: - case AppLifecycleState.paused: - return; - case AppLifecycleState.resumed: - if (!_scannerController.value.isRunning && !_isScannerStarting) { - _isScannerStarting = true; - _subscription = _scannerController.barcodes.listen(foundCode); - unawaited(_scannerController.start().then((_) { - _isScannerStarting = false; - })); - } - case AppLifecycleState.inactive: - unawaited(_subscription?.cancel()); - _subscription = null; - unawaited(_scannerController.stop().then((_) { - _isScannerStarting = false; - })); - } - } - - @override - void dispose() { - WidgetsBinding.instance.removeObserver(this); - unawaited(_subscription?.cancel()); - _subscription = null; - _scannerController.dispose(); - super.dispose(); - } - - @override - void initState() { - super.initState(); - WidgetsBinding.instance.addObserver(this); - _subscription = _scannerController.barcodes.listen(foundCode); - // unawaited(_scannerController.start()); - } - - @override - Widget build(BuildContext context) { - return SafeArea( - child: Scaffold( - body: Stack( - children: [ - MobileScanner( - controller: _scannerController, - onDetect: foundCode, - ), - Align( - alignment: Alignment.center, - child: Padding( - padding: const EdgeInsets.all(10.0), - child: Container( - width: 500, - height: 150, - decoration: BoxDecoration( - border: Border.all( - width: 5, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - ), - ), - Align( - alignment: AlignmentDirectional.bottomCenter, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(10.0), - child: MihButton( - onPressed: () { - _scannerController.stop(); - context.pop(); - }, - buttonColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 100, - height: 50, - child: Text( - "Cancel", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - // GestureDetector( - // onTap: () { - // scannerController.stop(); - // Navigator.of(context).pop(); - // }, - // child: const Text( - // "Cancel", - // style: TextStyle( - // fontWeight: FontWeight.bold, - // fontSize: 25, - // ), - // ), - // ), - // IconButton( - // onPressed: () {}, - // icon: const Icon( - // Icons.flip_camera_android, - // size: 30, - // ), - // ), - ], - ), - ) - ], - ), - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_wallet/components/mih_card_display.dart b/mih_ui/lib/mih_packages/mzansi_wallet/components/mih_card_display.dart deleted file mode 100644 index a7facfc3..00000000 --- a/mih_ui/lib/mih_packages/mzansi_wallet/components/mih_card_display.dart +++ /dev/null @@ -1,185 +0,0 @@ -import 'package:flutter/material.dart'; - -class MihCardDisplay extends StatefulWidget { - final String shopName; - final String nickname; - final double height; - const MihCardDisplay({ - super.key, - required this.shopName, - required this.height, - required this.nickname, - }); - - @override - State createState() => _MihCardDisplayState(); -} - -class _MihCardDisplayState extends State { - Widget? displayLoyaltyCard() { - switch (widget.shopName.toLowerCase()) { - case "apple tree": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/apple_tree-min.png'); - case "best before": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/best_before-min.png'); - case "checkers": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/checkers-min.png'); - case "clicks": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/clicks-min.png'); - case "cotton:on": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/cotton_on-min.png'); - case "dis-chem": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/dischem-min.png'); - case "pick n pay": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/pick_n_pay-min.png'); - case "shoprite": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/shoprite-min.png'); - case "spar": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/spar-min.png'); - case "woolworths": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/woolworths-min.png'); - case "makro": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/makro-min.png'); - case "fresh stop": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/fresh_stop-min.png'); - case "panarottis": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/panarottis-min.png'); - case "shell": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/shell-min.png'); - case "edgars": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/edgars-min.png'); - case "jet": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/jet-min.png'); - case "spur": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/spur-min.png'); - case "infinity": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/infinity-min.png'); - case "eskom": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/eskom-min.png'); - case "+more": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/plus_more-min.png'); - case "bp": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/bp-min.png'); - case "builders warehouse": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/builders-min.png'); - case "exclusive books": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/exclusive_books-min.png'); - case "pna": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/pna-min.png'); - case "pq clothing": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/pq-min.png'); - case "rage": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/rage-min.png'); - case "sasol": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/sasol-min.png'); - case "tfg group": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/tfg-min.png'); - case "toys r us": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/toysrus-min.png'); - case "leroy merlin": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/leroy_merlin-min.png'); - case "signature cosmetics & fragrances": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/signature_cosmetics-min.png'); - case "ok foods": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/ok_food-min.png'); - case "choppies": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/choppies-min.png'); - case "boxer": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/boxer-min.png'); - case "carrefour": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/carrefour-min.png'); - case "sefalana": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/sefalana-min.png'); - case "big save": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/big_save-min.png'); - case "justrite": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/justrite-min.png'); - case "naivas": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/naivas-min.png'); - case "kero": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/kero-min.png'); - case "auchan": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/auchan-min.png'); - case "woermann brock": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/woermann_brock-min.png'); - case "continente": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/continente-min.png'); - case "fresmart": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/fresmart-min.png'); - case "total energies": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/total_energies-min.png'); - case "engen": - return Image.asset( - 'lib/mih_package_components/assets/images/loyalty_cards/mini/engen-min.png'); - default: - return null; - } - } - - @override - Widget build(BuildContext context) { - return Visibility( - visible: displayLoyaltyCard() != null, - child: Column( - children: [ - displayLoyaltyCard() != null ? displayLoyaltyCard()! : SizedBox(), - FittedBox( - child: Text( - widget.nickname, - textAlign: TextAlign.center, - style: const TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ) - ], - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_wallet/mih_wallet.dart b/mih_ui/lib/mih_packages/mzansi_wallet/mih_wallet.dart deleted file mode 100644 index 88eebbdb..00000000 --- a/mih_ui/lib/mih_packages/mzansi_wallet/mih_wallet.dart +++ /dev/null @@ -1,139 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_wallet_provider.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/package_tools/mih_card_favourites.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/package_tools/mih_cards.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_data_helper_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_wallet_services.dart'; -import 'package:provider/provider.dart'; - -class MihWallet extends StatefulWidget { - const MihWallet({ - super.key, - }); - - @override - State createState() => _MihWalletState(); -} - -class _MihWalletState extends State { - bool _isLoadingInitialData = true; - late final MihCards _cards; - late final MihCardFavourites _cardFavourites; - - Future _loadInitialData() async { - setState(() { - _isLoadingInitialData = true; - }); - MzansiProfileProvider mzansiProfileProvider = - context.read(); - MzansiWalletProvider walletProvider = context.read(); - if (mzansiProfileProvider.user == null) { - await MihDataHelperServices().loadUserDataOnly( - mzansiProfileProvider, - ); - } - await setLoyaltyCards(mzansiProfileProvider, walletProvider); - await setFavouritesCards(mzansiProfileProvider, walletProvider); - setState(() { - _isLoadingInitialData = false; - }); - } - - Future setLoyaltyCards( - MzansiProfileProvider mzansiProfileProvider, - MzansiWalletProvider walletProvider, - ) async { - await MIHMzansiWalletApis.getLoyaltyCards( - walletProvider, mzansiProfileProvider.user!.app_id, context); - } - - Future setFavouritesCards( - MzansiProfileProvider mzansiProfileProvider, - MzansiWalletProvider walletProvider, - ) async { - await MIHMzansiWalletApis.getFavouriteLoyaltyCards( - walletProvider, mzansiProfileProvider.user!.app_id, context); - } - - @override - void initState() { - super.initState(); - _cards = MihCards(); - _cardFavourites = MihCardFavourites(); - _loadInitialData(); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, MzansiWalletProvider walletProvider, - Widget? child) { - if (_isLoadingInitialData) { - return Scaffold( - body: Center( - child: Mihloadingcircle(), - ), - ); - } - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: getToolTitle(), - selectedbodyIndex: walletProvider.toolIndex, - onIndexChange: (newIndex) { - walletProvider.setToolIndex(newIndex); - }, - ); - }, - ); - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - context.goNamed( - 'mihHome', - ); - FocusScope.of(context).unfocus(); - }, - ); - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.card_membership)] = () { - context.read().setToolIndex(0); - }; - temp[const Icon(Icons.favorite)] = () { - context.read().setToolIndex(1); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: context.watch().toolIndex, - ); - } - - List getToolBody() { - return [ - _cards, - _cardFavourites, - ]; - } - - List getToolTitle() { - List toolTitles = [ - "Cards", - "Favourites", - ]; - return toolTitles; - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_wallet/package_tiles/mih_wallet_tile.dart b/mih_ui/lib/mih_packages/mzansi_wallet/package_tiles/mih_wallet_tile.dart deleted file mode 100644 index 74a3951d..00000000 --- a/mih_ui/lib/mih_packages/mzansi_wallet/package_tiles/mih_wallet_tile.dart +++ /dev/null @@ -1,46 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class MihWalletTile extends StatefulWidget { - final double packageSize; - - const MihWalletTile({ - super.key, - required this.packageSize, - }); - - @override - State createState() => _MihWalletTileState(); -} - -class _MihWalletTileState extends State { - @override - Widget build(BuildContext context) { - return MihPackageTile( - // authenticateUser: true, - onTap: () { - context.goNamed( - 'mzansiWallet', - ); - // Navigator.of(context).pushNamed( - // '/mzansi-wallet', - // arguments: WalletArguments(widget.signedInUser, 0), - // ); - }, - appName: "Mzansi Wallet", - appIcon: Icon( - MihIcons.mzansiWallet, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // size: widget.packageSize, - ), - iconSize: widget.packageSize, - textColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_wallet/package_tools/mih_card_favourites.dart b/mih_ui/lib/mih_packages/mzansi_wallet/package_tools/mih_card_favourites.dart deleted file mode 100644 index 9e5a0f62..00000000 --- a/mih_ui/lib/mih_packages/mzansi_wallet/package_tools/mih_card_favourites.dart +++ /dev/null @@ -1,49 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_wallet_provider.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_objects/loyalty_card.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/builder/build_loyalty_card_list.dart'; -import 'package:provider/provider.dart'; - -class MihCardFavourites extends StatefulWidget { - const MihCardFavourites({ - super.key, - }); - - @override - State createState() => _MihCardFavouritesState(); -} - -class _MihCardFavouritesState extends State { - late Future> cardList; - List listOfCards = []; - - void getFavouriteLoyaltyCards(BuildContext context) async { - setState(() { - listOfCards = context.read().favouriteCards; - }); - } - - @override - void initState() { - getFavouriteLoyaltyCards(context); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(), - ); - } - - Widget getBody() { - return BuildLoyaltyCardList( - cardList: listOfCards, - navIndex: 0, - favouritesMode: true, - searchText: TextEditingController(), - ); - } -} diff --git a/mih_ui/lib/mih_packages/mzansi_wallet/package_tools/mih_cards.dart b/mih_ui/lib/mih_packages/mzansi_wallet/package_tools/mih_cards.dart deleted file mode 100644 index 3fa5eae6..00000000 --- a/mih_ui/lib/mih_packages/mzansi_wallet/package_tools/mih_cards.dart +++ /dev/null @@ -1,185 +0,0 @@ -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_wallet_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_add_card_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart'; -import 'package:mzansi_innovation_hub/mih_objects/loyalty_card.dart'; -import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/builder/build_loyalty_card_list.dart'; -import 'package:flutter/material.dart'; -import 'package:mobile_scanner/mobile_scanner.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:provider/provider.dart'; - -class MihCards extends StatefulWidget { - const MihCards({ - super.key, - }); - - @override - State createState() => _MihCardsState(); -} - -class _MihCardsState extends State { - final TextEditingController cardSearchController = TextEditingController(); - final FocusNode searchFocusNode = FocusNode(); - final ValueNotifier> searchShopName = ValueNotifier([]); - final MobileScannerController scannerController = MobileScannerController( - detectionSpeed: DetectionSpeed.unrestricted, - ); - final boxFit = BoxFit.contain; - late MzansiWalletProvider _walletProvider; - late VoidCallback _searchListener; - - void searchShop(List allCards) { - if (cardSearchController.text.isEmpty) { - searchShopName.value = allCards; - } else { - List temp = []; - for (var item in allCards) { - if (item.shop_name - .toLowerCase() - .contains(cardSearchController.text.toLowerCase()) || - item.nickname - .toLowerCase() - .contains(cardSearchController.text.toLowerCase())) { - temp.add(item); - } - } - searchShopName.value = temp; - } - } - - void successPopUp(String title, String message, int packageIndex) { - MihAlertServices().successBasicAlert( - title, - message, - context, - ); - } - - void addCardWindow(BuildContext ctxt, double width) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihAddCardWindow(), - ); - } - - @override - void dispose() { - cardSearchController.removeListener(_searchListener); - cardSearchController.dispose(); - searchShopName.dispose(); - searchFocusNode.dispose(); - super.dispose(); - } - - @override - void initState() { - _walletProvider = context.read(); - _searchListener = () { - searchShop(_walletProvider.loyaltyCards); - }; - searchShopName.value = _walletProvider.loyaltyCards; - cardSearchController.addListener(_searchListener); - super.initState(); - } - - @override - Widget build(BuildContext context) { - final Size size = MediaQuery.sizeOf(context); - final double width = size.width; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(width), - ); - } - - Widget getBody(double width) { - return Consumer( - builder: (BuildContext context, MzansiWalletProvider walletProvider, - Widget? child) { - if (cardSearchController.text.isEmpty) { - searchShopName.value = walletProvider.loyaltyCards; - } else { - // Re-run search with updated card list - searchShop(walletProvider.loyaltyCards); - } - return Stack( - children: [ - Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: MihSearchBar( - controller: cardSearchController, - hintText: "Search Cards", - // prefixIcon: Icons.search, - prefixIcon: Icons.search, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - hintColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onPrefixIconTap: () { - // print("Search Icon Pressed: ${cardSearchController.text}"); - }, - searchFocusNode: searchFocusNode, - ), - ), - const SizedBox(height: 10), - Expanded( - child: ValueListenableBuilder>( - valueListenable: searchShopName, - builder: (context, filteredCards, child) { - return BuildLoyaltyCardList( - cardList: filteredCards, //listOfCards, - navIndex: 0, - favouritesMode: false, - searchText: cardSearchController, - ); - }, - ), - ), - ], - ), - Positioned( - right: 10, - bottom: 10, - child: MihFloatingMenu( - animatedIcon: AnimatedIcons.menu_close, - children: [ - SpeedDialChild( - child: Icon( - Icons.add, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - label: "Add Loyalty Card", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onTap: () { - addCardWindow(context, width); - }, - ) - ]), - ) - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_manager/list_builders/build_mih_patient_search_list.dart b/mih_ui/lib/mih_packages/patient_manager/pat_manager/list_builders/build_mih_patient_search_list.dart deleted file mode 100644 index 10c97f4d..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_manager/list_builders/build_mih_patient_search_list.dart +++ /dev/null @@ -1,578 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_access_controls_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_patient_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_objects/arguments.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class BuildMihPatientSearchList extends StatefulWidget { - const BuildMihPatientSearchList({ - super.key, - }); - - @override - State createState() => _BuildPatientsListState(); -} - -class _BuildPatientsListState extends State { - TextEditingController dateController = TextEditingController(); - TextEditingController timeController = TextEditingController(); - TextEditingController idController = TextEditingController(); - TextEditingController fnameController = TextEditingController(); - TextEditingController lnameController = TextEditingController(); - TextEditingController accessStatusController = TextEditingController(); - final baseAPI = AppEnviroment.baseApiUrl; - - Future hasAccessToProfile(MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, int index) async { - var hasAccess = false; - await MihAccessControlsServices.checkBusinessAccessToPatient( - profileProvider.business!.business_id, - patientManagerProvider.patientSearchResults[index].app_id) - .then((results) { - if (results.isEmpty) { - setState(() { - hasAccess = false; - }); - } else if (results[0].status == "approved") { - setState(() { - hasAccess = true; - }); - } else { - setState(() { - hasAccess = false; - }); - } - }); - return hasAccess; - } - - Future getAccessStatusOfProfile(MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, int index) async { - var accessStatus = ""; - await MihAccessControlsServices.checkBusinessAccessToPatient( - profileProvider.business!.business_id, - patientManagerProvider.patientSearchResults[index].app_id) - .then((results) { - if (results.isEmpty) { - setState(() { - accessStatus = ""; - }); - } else { - setState(() { - accessStatus = results[0].status; - }); - } - }); - return accessStatus; - } - - Future refreshMyPatientList(MzansiProfileProvider mzansiProfileProvider, - PatientManagerProvider patientManagerProvider) async { - await MihPatientServices().getPatientAccessListOfBusiness( - patientManagerProvider, mzansiProfileProvider.business!.business_id); - } - - void patientProfileChoicePopUp( - MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, - int index, - ) async { - var hasAccess = false; - String accessStatus = ""; - await hasAccessToProfile(profileProvider, patientManagerProvider, index) - .then((result) { - setState(() { - hasAccess = result; - }); - }); - await getAccessStatusOfProfile( - profileProvider, patientManagerProvider, index) - .then((result) { - setState(() { - accessStatus = result; - }); - }); - if (accessStatus == "") { - accessStatus = "No Access"; - } - String patientIdNo = - patientManagerProvider.patientSearchResults[index].id_no; - String displayedIdNo; - - if (patientIdNo.length >= 6) { - var idStars = '*' * (patientIdNo.length - 6); - displayedIdNo = "${patientIdNo.substring(0, 6)}$idStars"; - } else { - displayedIdNo = "${patientIdNo}******"; - } - setState(() { - idController.text = displayedIdNo; - fnameController.text = - patientManagerProvider.patientSearchResults[index].first_name; - lnameController.text = - patientManagerProvider.patientSearchResults[index].last_name; - accessStatusController.text = accessStatus.toUpperCase(); - }); - //print(accessStatus); - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: "Patient Profile", - onWindowTapClose: () { - Navigator.pop(context); - }, - windowBody: Column( - children: [ - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: idController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "ID No.", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: fnameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "First Name", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: lnameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Surname", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: accessStatusController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Access Status", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 20.0), - Visibility( - visible: !hasAccess, - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "Important Notice: Requesting Patient Profile Access", - style: TextStyle( - fontWeight: FontWeight.bold, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - Text( - "You are about to request access to a patient's profile. Please be aware of the following important points:", - style: TextStyle( - fontWeight: FontWeight.normal, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - SizedBox( - width: 600, - child: Text( - "1. Permanent Access: Once the patient accepts your access request, it will become permanent.", - style: TextStyle( - fontWeight: FontWeight.normal, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - SizedBox( - width: 600, - child: Text( - "2. Shared Information: Any updates you make to the patient's profile will be visible to others who have access to the profile.", - style: TextStyle( - fontWeight: FontWeight.normal, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - SizedBox( - width: 600, - child: Text( - "3. Irreversible Access: Once granted, you cannot revoke your access to the patient's profile.", - style: TextStyle( - fontWeight: FontWeight.normal, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - Text( - "By pressing the \"Request Access\" button you accept the above terms.\n", - style: TextStyle( - fontWeight: FontWeight.bold, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ], - ), - ), - // const SizedBox(height: 15.0), - Center( - child: Wrap( - alignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - runSpacing: 10, - spacing: 10, - children: [ - Visibility( - visible: hasAccess, - child: Center( - child: MihButton( - onPressed: () async { - if (hasAccess) { - await MihPatientServices().getPatientDetails( - patientManagerProvider - .patientSearchResults[index].app_id, - patientManagerProvider); - context.pop(); - context.pushNamed( - 'patientManagerPatient', - ); - // context.pushNamed( - // 'patientPatient', - // extra: patientManagerProvider - // .patientSearchResults![index].app_id, - // ); - // Navigator.of(context) - // .pushNamed('/patient-manager/patient', - // arguments: PatientViewArguments( - // widget.signedInUser, - // widget.patients[index], - // widget.businessUser, - // widget.business, - // "business", - // )); - } else { - MihAlertServices().warningAlert( - "Access Pending", - "Your access request is currently being reviewed.\nOnce approved, you'll be able to view patient data.\nPlease follow up with the patient to approve your access request.", - context, - ); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "View Profile", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ), - Visibility( - visible: !hasAccess && accessStatus == "No Access", - child: Center( - child: MihButton( - onPressed: () async { - await MihAccessControlsServices - .addPatientAccessAPICall( - profileProvider.business!.business_id, - patientManagerProvider - .patientSearchResults[index].app_id, - "patient", - profileProvider.business!.Name, - patientManagerProvider.personalMode, - BusinessArguments( - profileProvider.user!, - profileProvider.businessUser, - profileProvider.business, - ), - context, - ); - refreshMyPatientList( - profileProvider, patientManagerProvider); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Request Access", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ), - Visibility( - visible: !hasAccess && accessStatus == "declined", - child: Center( - child: MihButton( - onPressed: () async { - await MihAccessControlsServices - .reapplyPatientAccessAPICall( - profileProvider.business!.business_id, - patientManagerProvider - .patientSearchResults[index].app_id, - patientManagerProvider.personalMode, - BusinessArguments( - profileProvider.user!, - profileProvider.businessUser, - profileProvider.business, - ), - context, - ); - refreshMyPatientList( - profileProvider, patientManagerProvider); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Re-apply", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ), - Visibility( - visible: !hasAccess && accessStatus == "pending", - child: const SizedBox( - width: 500, - //height: 50, - child: Text( - "Patient has not approved access to their profile. Once access has been approved you can book and appointment or view their profile."), - ), - ), - ], - ), - ), - ], - ), - ), - ); - } - - Widget isMainMember( - PatientManagerProvider patientManagerProvider, int index) { - if (patientManagerProvider - .patientSearchResults[index].medical_aid_main_member == - "Yes") { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - Text( - // "$firstLetterFName$fnameStar $firstLetterLName$lnameStar", - "${patientManagerProvider.patientSearchResults[index].first_name} ${patientManagerProvider.patientSearchResults[index].last_name}", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox( - width: 10, - ), - Icon( - Icons.star_border_rounded, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ], - ); - } else { - return Text( - // "$firstLetterFName$fnameStar $firstLetterLName$lnameStar", - "${patientManagerProvider.patientSearchResults[index].first_name} ${patientManagerProvider.patientSearchResults[index].last_name}", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ); - } - } - - Widget hasMedicalAid( - MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, - int index, - ) { - String patientIdNo = - patientManagerProvider.patientSearchResults[index].id_no; - String displayedIdNo; - var medAidNoStar = '*' * 8; - if (patientIdNo.length >= 6) { - var idStars = '*' * (patientIdNo.length - 6); - displayedIdNo = "${patientIdNo.substring(0, 6)}$idStars"; - } else { - // If ID is shorter than 6 characters, just show it with stars - displayedIdNo = "${patientIdNo}******"; - } - - if (patientManagerProvider.patientSearchResults[index].medical_aid == - "Yes") { - return ListTile( - title: isMainMember(patientManagerProvider, index), - subtitle: Text( - "ID No.: $displayedIdNo\nMedical Aid No.: $medAidNoStar", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - onTap: () { - patientProfileChoicePopUp( - profileProvider, patientManagerProvider, index); - // setState(() { - // appointmentPopUp(index); - // // Add popup to add patienmt to queue - // // Navigator.of(context).pushNamed('/patient-manager/patient', - // // arguments: PatientViewArguments( - // // widget.signedInUser, widget.patients[index], "business")); - // }); - }, - trailing: Icon( - Icons.arrow_forward, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ); - } else { - return ListTile( - title: isMainMember(patientManagerProvider, index), - subtitle: Text( - "ID No.: $displayedIdNo\nMedical Aid No.: $medAidNoStar", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - onTap: () { - patientProfileChoicePopUp( - profileProvider, patientManagerProvider, index); - // setState(() { - // appointmentPopUp(index); - // // Navigator.of(context).pushNamed('/patient-manager/patient', - // // arguments: PatientViewArguments( - // // widget.signedInUser, widget.patients[index], "business")); - // }); - }, - trailing: Icon( - Icons.add, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ); - } - } - - @override - void dispose() { - dateController.dispose(); - timeController.dispose(); - idController.dispose(); - fnameController.dispose(); - lnameController.dispose(); - accessStatusController.dispose(); - PatientManagerProvider patientManagerProvider = - context.read(); - patientManagerProvider.setPatientSearchResults(patientSearchResults: []); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, Widget? child) { - return ListView.separated( - separatorBuilder: (BuildContext context, index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemCount: patientManagerProvider.patientSearchResults.length, - itemBuilder: (context, index) { - KenLogger.success( - "Search Results Count: ${patientManagerProvider.patientSearchResults.length}"); - return hasMedicalAid( - profileProvider, patientManagerProvider, index); - }, - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_manager/list_builders/build_my_patient_list_list.dart b/mih_ui/lib/mih_packages/patient_manager/pat_manager/list_builders/build_my_patient_list_list.dart deleted file mode 100644 index 14760a10..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_manager/list_builders/build_my_patient_list_list.dart +++ /dev/null @@ -1,543 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_patient_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_calendar_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_date_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_time_field.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class BuildMyPatientListList extends StatefulWidget { - const BuildMyPatientListList({ - super.key, - }); - - @override - State createState() => _BuildPatientsListState(); -} - -class _BuildPatientsListState extends State { - TextEditingController dateController = TextEditingController(); - TextEditingController timeController = TextEditingController(); - TextEditingController idController = TextEditingController(); - TextEditingController fnameController = TextEditingController(); - TextEditingController lnameController = TextEditingController(); - final _formKey = GlobalKey(); - - final baseAPI = AppEnviroment.baseApiUrl; - - Future submitApointment(MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, int index) async { - //To-Do: Add the appointment to the database - // print("To-Do: Add the appointment to the database"); - String description = - "Date: ${dateController.text}\nTime: ${timeController.text}\n"; - description += "Medical Practice: ${profileProvider.business!.Name}\n"; - description += "Contact Number: ${profileProvider.business!.contact_no}"; - int statusCode; - statusCode = await MihMzansiCalendarApis.addPatientAppointment( - profileProvider.user!, - false, - patientManagerProvider.myPaitentList![index].app_id, - profileProvider.business!.business_id, - "${patientManagerProvider.myPaitentList![index].fname} ${patientManagerProvider.myPaitentList![index].lname} - Doctors Visit", - description, - dateController.text, - timeController.text, - context, - ); - if (statusCode == 201) { - context.pop(); - successPopUp("Successfully Added Appointment", - "You appointment has been successfully added to your calendar."); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - void successPopUp(String title, String message) { - MihAlertServices().successAdvancedAlert( - title, - message, - [ - MihButton( - onPressed: () { - context.pop(); - context.pop(); - setState(() { - dateController.clear(); - timeController.clear(); - idController.clear(); - fnameController.clear(); - lnameController.clear(); - }); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - bool isAppointmentFieldsFilled() { - if (dateController.text.isEmpty || timeController.text.isEmpty) { - return false; - } else { - return true; - } - } - - void appointmentPopUp( - MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, - int index, - double width, - ) { - var firstLetterFName = patientManagerProvider.myPaitentList![index].fname; - var firstLetterLName = patientManagerProvider.myPaitentList![index].lname; - setState(() { - idController.text = patientManagerProvider.myPaitentList![index].id_no; - fnameController.text = firstLetterFName; - lnameController.text = firstLetterLName; - }); - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: "Patient Appointment", - onWindowTapClose: () { - Navigator.pop(context); - }, - windowBody: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.056) - : const EdgeInsets.symmetric(horizontal: 0), - child: Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: idController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "ID No.", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: fnameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "First Name", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: lnameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Surname", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihDateField( - controller: dateController, - labelText: "Date", - required: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTimeField( - controller: timeController, - labelText: "Time", - required: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 30.0), - Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - bool filled = isAppointmentFieldsFilled(); - if (filled) { - submitApointment( - profileProvider, patientManagerProvider, index); - } else { - MihAlertServices().inputErrorAlert(context); - } - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Book Appointment", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ], - ), - ), - ), - ); - } - - void noAccessWarning( - PatientManagerProvider patientManagerProvider, int index) { - if (patientManagerProvider.myPaitentList![index].status == "pending") { - MihAlertServices().warningAlert( - "Access Pending", - "Your access request is currently being reviewed.\nOnce approved, you'll be able to view patient data.\nPlease follow up with the patient to approve your access request.", - context, - ); - } else { - MihAlertServices().errorBasicAlert( - "Access Declined", - "Your request to access the patient's profile has been denied. Please contact the patient directly to inquire about the reason for this restriction.", - context, - ); - } - } - - bool hasAccessToProfile( - PatientManagerProvider patientManagerProvider, int index) { - var hasAccess = false; - - if (patientManagerProvider.myPaitentList![index].status == "approved") { - hasAccess = true; - } else { - hasAccess = false; - } - return hasAccess; - } - - void patientProfileChoicePopUp( - MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, - int index, - double width, - ) async { - var firstLetterFName = patientManagerProvider.myPaitentList![index].fname; - var firstLetterLName = patientManagerProvider.myPaitentList![index].lname; - setState(() { - idController.text = patientManagerProvider.myPaitentList![index].id_no; - fnameController.text = firstLetterFName; - lnameController.text = firstLetterLName; - }); - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: "Patient Profile", - onWindowTapClose: () { - Navigator.pop(context); - }, - windowBody: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.05) - : const EdgeInsets.symmetric(horizontal: 0), - child: Column( - children: [ - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: idController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "ID No.", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: fnameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "First Name", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: lnameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Surname", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 30.0), - Center( - child: Wrap( - runAlignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - alignment: WrapAlignment.center, - runSpacing: 10, - spacing: 10, - children: [ - MihButton( - onPressed: () { - appointmentPopUp(profileProvider, - patientManagerProvider, index, width); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Book Appointment", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () async { - await MihPatientServices().getPatientDetails( - patientManagerProvider.myPaitentList![index].app_id, - patientManagerProvider); - context.pop(); - context.pushNamed( - 'patientManagerPatient', - ); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "View Medical Records", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ) - ], - ), - ), - ), - ); - } - - Widget displayMyPatientTile( - MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, - int index, - double width, - ) { - var firstName = ""; - var lastName = ""; - String access = - patientManagerProvider.myPaitentList![index].status.toUpperCase(); - TextSpan accessWithColour; - var hasAccess = false; - hasAccess = hasAccessToProfile(patientManagerProvider, index); - //print(hasAccess); - if (access == "APPROVED") { - firstName = patientManagerProvider.myPaitentList![index].fname; - lastName = patientManagerProvider.myPaitentList![index].lname; - accessWithColour = TextSpan( - text: "$access\n", - style: TextStyle( - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"))); - } else if (access == "PENDING") { - firstName = - "${patientManagerProvider.myPaitentList![index].fname[0]}********"; - lastName = - "${patientManagerProvider.myPaitentList![index].lname[0]}********"; - accessWithColour = TextSpan( - text: "$access\n", - style: TextStyle( - color: MihColors.getGreyColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"))); - } else { - firstName = - "${patientManagerProvider.myPaitentList![index].fname[0]}********"; - lastName = - "${patientManagerProvider.myPaitentList![index].lname[0]}********"; - accessWithColour = TextSpan( - text: "$access\n", - style: TextStyle( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"))); - } - - return ListTile( - title: Text( - "$firstName $lastName", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - subtitle: RichText( - text: TextSpan( - text: - "ID No.: ${patientManagerProvider.myPaitentList![index].id_no}\n", - style: DefaultTextStyle.of(context).style, - children: [ - const TextSpan(text: "Access: "), - accessWithColour, - ]), - ), - onTap: () async { - if (hasAccess) { - await MihPatientServices() - .getPatientDetails( - patientManagerProvider.myPaitentList![index].app_id, - patientManagerProvider) - .then((result) {}); - await MihUserServices() - .getMIHUserDetails( - patientManagerProvider.myPaitentList![index].app_id, context) - .then((user) async { - user; - String url = await MihFileApi.getMinioFileUrl(user!.pro_pic_path); - patientManagerProvider.setSelectedPatientProfilePicUrl(url); - }); - patientProfileChoicePopUp( - profileProvider, patientManagerProvider, index, width); - } else { - noAccessWarning(patientManagerProvider, index); - } - }, - trailing: Icon( - Icons.arrow_forward, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ); - } - - @override - void initState() { - super.initState(); - } - - @override - void dispose() { - dateController.dispose(); - timeController.dispose(); - idController.dispose(); - fnameController.dispose(); - lnameController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, Widget? child) { - return ListView.separated( - separatorBuilder: (BuildContext context, index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemCount: patientManagerProvider.myPaitentList!.length, - itemBuilder: (context, index) { - return displayMyPatientTile( - profileProvider, patientManagerProvider, index, screenWidth); - }, - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_manager/list_builders/build_waiting_room_list.dart b/mih_ui/lib/mih_packages/patient_manager/pat_manager/list_builders/build_waiting_room_list.dart deleted file mode 100644 index 9fc68a82..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_manager/list_builders/build_waiting_room_list.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:flutter/material.dart'; - -class BuildWaitingRoomList extends StatefulWidget { - const BuildWaitingRoomList({super.key}); - - @override - State createState() => _BuildWaitingRoomListState(); -} - -class _BuildWaitingRoomListState extends State { - @override - Widget build(BuildContext context) { - return const Placeholder(); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_manager/package_tiles/pat_manager_tile.dart b/mih_ui/lib/mih_packages/patient_manager/pat_manager/package_tiles/pat_manager_tile.dart deleted file mode 100644 index 5179a99f..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_manager/package_tiles/pat_manager_tile.dart +++ /dev/null @@ -1,48 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_objects/arguments.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class PatManagerTile extends StatefulWidget { - final PatManagerArguments arguments; - final double packageSize; - const PatManagerTile({ - super.key, - required this.arguments, - required this.packageSize, - }); - - @override - State createState() => _PatManagerTileState(); -} - -class _PatManagerTileState extends State { - @override - Widget build(BuildContext context) { - return MihPackageTile( - authenticateUser: true, - onTap: () { - context.goNamed( - 'patientManager', - ); - // Navigator.of(context).pushNamed( - // '/patient-manager', - // arguments: widget.arguments, - // ); - }, - appName: "Patient Manager", - appIcon: Icon( - MihIcons.patientManager, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // size: widget.packageSize, - ), - iconSize: widget.packageSize, - textColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_manager/package_tools/mih_patient_search.dart b/mih_ui/lib/mih_packages/patient_manager/pat_manager/package_tools/mih_patient_search.dart deleted file mode 100644 index 1a1e3a50..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_manager/package_tools/mih_patient_search.dart +++ /dev/null @@ -1,214 +0,0 @@ -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_patient_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_objects/patient_access.dart'; -import 'package:mzansi_innovation_hub/mih_objects/patients.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_manager/list_builders/build_mih_patient_search_list.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class MihPatientSearch extends StatefulWidget { - const MihPatientSearch({ - super.key, - }); - - @override - State createState() => _MihPatientSearchState(); -} - -class _MihPatientSearchState extends State { - TextEditingController _mihPatientSearchController = TextEditingController(); - final FocusNode _focusNode = FocusNode(); - final FocusNode _searchFocusNode = FocusNode(); - bool hasSearchedBefore = false; - String _mihPatientSearchString = ""; - String baseUrl = AppEnviroment.baseApiUrl; - - Widget getPatientSearch(double width) { - return Consumer( - builder: (BuildContext context, - PatientManagerProvider patientManagerProvider, Widget? child) { - return Column(mainAxisSize: MainAxisSize.max, children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: MihSearchBar( - controller: _mihPatientSearchController, - hintText: "Search Patient ID/ Aid No.", - prefixIcon: Icons.search, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - hintColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onPrefixIconTap: () { - submitPatientSearch(patientManagerProvider); - }, - onClearIconTap: () { - setState(() { - _mihPatientSearchController.clear(); - _mihPatientSearchString = ""; - }); - patientManagerProvider - .setPatientSearchResults(patientSearchResults: []); - }, - searchFocusNode: _searchFocusNode, - ), - ), - //spacer - const SizedBox(height: 10), - - displayPatientList(patientManagerProvider, _mihPatientSearchString), - ]); - }, - ); - } - - List filterSearchResults(List patList, String query) { - List templist = []; - //print(query); - for (var item in patList) { - if (item.id_no.contains(_mihPatientSearchString) || - item.medical_aid_no.contains(_mihPatientSearchString)) { - //print(item.medical_aid_no); - templist.add(item); - } - } - return templist; - } - - Widget displayPatientList( - PatientManagerProvider patientManagerProvider, String searchString) { - if (patientManagerProvider.patientSearchResults.isNotEmpty) { - return Expanded( - child: BuildMihPatientSearchList(), - ); - } else if (patientManagerProvider.patientSearchResults.isEmpty && - searchString != "") { - return Column( - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.iDontKnow, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "Let's try refining your search", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ], - ); - } else { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.patientProfile, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "Search for a Patient of Mzansi to add to your Patient List", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - children: [ - TextSpan( - text: - "You can search using their ID Number or Medical Aid No."), - ], - ), - ), - ), - ], - ), - ); - } - } - - Future submitPatientSearch( - PatientManagerProvider patientManagerProvider) async { - if (_mihPatientSearchController.text != "") { - setState(() { - _mihPatientSearchString = _mihPatientSearchController.text; - hasSearchedBefore = true; - }); - await MihPatientServices.searchPatients( - patientManagerProvider, _mihPatientSearchString); - } - } - - //Patient Access Widgets/ Functions - List filterAccessResults( - List patAccList, String query) { - List templist = []; - //print(query); - for (var item in patAccList) { - if (item.id_no.contains(query)) { - //print(item.medical_aid_no); - templist.add(item); - } - } - return templist; - } - - @override - void initState() { - super.initState(); - } - - @override - void dispose() { - super.dispose(); - _searchFocusNode.dispose(); - _mihPatientSearchController.dispose(); - _focusNode.dispose(); - } - - @override - Widget build(BuildContext context) { - final Size size = MediaQuery.sizeOf(context); - final double width = size.width; - return MihPackageToolBody( - borderOn: false, - innerHorizontalPadding: 10, - bodyItem: getPatientSearch(width), - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_manager/package_tools/my_patient_list.dart b/mih_ui/lib/mih_packages/patient_manager/pat_manager/package_tools/my_patient_list.dart deleted file mode 100644 index e1cbd787..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_manager/package_tools/my_patient_list.dart +++ /dev/null @@ -1,221 +0,0 @@ -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_patient_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_objects/patient_access.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_manager/list_builders/build_my_patient_list_list.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class MyPatientList extends StatefulWidget { - const MyPatientList({ - super.key, - }); - - @override - State createState() => _MyPatientListState(); -} - -class _MyPatientListState extends State { - TextEditingController _myPatientSearchController = TextEditingController(); - final FocusNode _searchFocusNode = FocusNode(); - bool hasSearchedBefore = false; - String _myPatientIdSearchString = ""; - String baseUrl = AppEnviroment.baseApiUrl; - - final FocusNode _focusNode = FocusNode(); - - Widget myPatientListTool(MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, double width) { - return Column(mainAxisSize: MainAxisSize.max, children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: MihSearchBar( - controller: _myPatientSearchController, - hintText: "Search Patient ID", - prefixIcon: Icons.search, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - hintColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onPrefixIconTap: () { - setState(() async { - _myPatientIdSearchString = _myPatientSearchController.text; - await MihPatientServices().getPatientAccessListOfBusiness( - patientManagerProvider, - profileProvider.business!.business_id); - }); - }, - onClearIconTap: () { - setState(() { - _myPatientSearchController.clear(); - _myPatientIdSearchString = ""; - }); - getMyPatientList(profileProvider, patientManagerProvider); - }, - searchFocusNode: _searchFocusNode, - ), - ), - //spacer - const SizedBox(height: 10), - displayMyPatientList(patientManagerProvider), - ]); - } - - Widget displayMyPatientList(PatientManagerProvider patientManagerProvider) { - if (patientManagerProvider.myPaitentList!.isNotEmpty) { - return Expanded(child: BuildMyPatientListList()); - } - if (hasSearchedBefore && _myPatientIdSearchString.isNotEmpty) { - return Column( - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.iDontKnow, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "Let's try refining your search", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ], - ); - } else { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.patientProfile, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "You dont have access to any Patients Profile", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - Icons.search, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - TextSpan( - text: - " to use Patient Search to request access to their profile."), - ], - ), - ), - ), - ], - ), - ); - } - // return Padding( - // padding: const EdgeInsets.only(top: 35.0), - // child: Center( - // child: Text( - // "No Patients matching search", - // style: TextStyle( - // fontSize: 25, - // color: MihColors.getGreyColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark")), - // textAlign: TextAlign.center, - // ), - // ), - // ); - } - - List filterAccessResults( - List patAccList, String query) { - List templist = []; - for (var item in patAccList) { - if (item.id_no.contains(query)) { - templist.add(item); - } - } - return templist; - } - - Future getMyPatientList(MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider) async { - await MihPatientServices().getPatientAccessListOfBusiness( - patientManagerProvider, profileProvider.business!.business_id); - setState(() { - hasSearchedBefore = true; - }); - } - - @override - void initState() { - super.initState(); - } - - @override - void dispose() { - super.dispose(); - _myPatientSearchController.dispose(); - _searchFocusNode.dispose(); - _focusNode.dispose(); - } - - @override - Widget build(BuildContext context) { - final Size size = MediaQuery.sizeOf(context); - final double width = size.width; - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, Widget? child) { - return MihPackageToolBody( - borderOn: false, - innerHorizontalPadding: 10, - bodyItem: - myPatientListTool(profileProvider, patientManagerProvider, width), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_manager/package_tools/waiting_room.dart b/mih_ui/lib/mih_packages/patient_manager/pat_manager/package_tools/waiting_room.dart deleted file mode 100644 index d447f76c..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_manager/package_tools/waiting_room.dart +++ /dev/null @@ -1,558 +0,0 @@ -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_calendar_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_calendar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_date_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_time_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_objects/appointment.dart'; -import 'package:mzansi_innovation_hub/mih_packages/calendar/builder/build_appointment_list.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class WaitingRoom extends StatefulWidget { - const WaitingRoom({ - super.key, - }); - - @override - State createState() => _WaitingRoomState(); -} - -class _WaitingRoomState extends State { - TextEditingController selectedAppointmentDateController = - TextEditingController(); - final TextEditingController _appointmentTitleController = - TextEditingController(); - final TextEditingController _appointmentDescriptionIDController = - TextEditingController(); - final TextEditingController _appointmentDateController = - TextEditingController(); - final TextEditingController _appointmentTimeController = - TextEditingController(); - final TextEditingController _patientController = TextEditingController(); - String baseUrl = AppEnviroment.baseApiUrl; - - late Future> businessAppointmentResults; - late Future> appointmentResults; - bool inWaitingRoom = true; - bool isLoading = true; - final _formKey = GlobalKey(); - - // Business Appointment Tool - Widget getBusinessAppointmentsTool(double width) { - return Consumer3( - builder: (BuildContext context, - MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, - MihCalendarProvider mihCalendarProvider, - Widget? child) { - if (isLoading) { - return const Center( - child: Mihloadingcircle(), - ); - } - return Stack( - children: [ - Column( - children: [ - MIHCalendar( - calendarWidth: 500, - rowHeight: 35, - setDate: (value) { - mihCalendarProvider.setSelectedDay(value); - setState(() { - selectedAppointmentDateController.text = value; - }); - }), - // Divider( - // color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - displayAppointmentList(mihCalendarProvider) - ], - ), - Positioned( - right: 10, - bottom: 10, - child: MihFloatingMenu( - icon: Icons.add, - animatedIcon: AnimatedIcons.menu_close, - children: [ - SpeedDialChild( - child: Icon( - Icons.add, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - label: "Add Appointment", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - // addAppointmentWindow(); - appointmentTypeSelection(profileProvider, - patientManagerProvider, mihCalendarProvider, width); - }, - ) - ], - ), - ), - ], - ); - }, - ); - } - - Widget displayAppointmentList(MihCalendarProvider mihCalendarProvider) { - if (mihCalendarProvider.businessAppointments!.isNotEmpty) { - return Expanded( - child: BuildAppointmentList( - inWaitingRoom: true, - titleController: _appointmentTitleController, - descriptionIDController: _appointmentDescriptionIDController, - patientIdController: _patientController, - dateController: _appointmentDateController, - timeController: _appointmentTimeController, - ), - ); - } - return Expanded( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.calendar, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - const SizedBox(height: 10), - Text( - "No Appointments for ${mihCalendarProvider.selectedDay}", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - Icons.menu, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - TextSpan( - text: - " to add an appointment or select a different date"), - ], - ), - ), - ), - ], - ), - ), - ); - // return Expanded( - // child: Padding( - // padding: const EdgeInsets.only(top: 35.0), - // child: Align( - // alignment: Alignment.center, - // child: Text( - // "No Appointments for $selectedDay", - // style: TextStyle( - // fontSize: 25, - // color: MihColors.getGreyColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - // textAlign: TextAlign.center, - // softWrap: true, - // ), - // ), - // ), - // ); - } - - void appointmentTypeSelection( - MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, - MihCalendarProvider mihCalendarProvider, - double width) { - String question = "What type of appointment would you like to add?"; - question += - "\n\nExisting Patient: Add an appointment for an patient your practice has access to."; - question += - "\nExisting MIH User: Add an appointment for an existing MIH user your practice does not have access to."; - question += - "\nSkeleton Appointment: Add an appointment without a patient linked."; - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: "Appointment Type", - onWindowTapClose: () { - context.pop(); - }, - windowBody: Column( - children: [ - Text( - question, - style: TextStyle( - fontSize: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark")), - textAlign: TextAlign.left, - ), - const SizedBox(height: 15), - MihButton( - onPressed: () { - patientManagerProvider.setPatientManagerIndex(1); - context.pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Existing Patient", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - MihButton( - onPressed: () { - patientManagerProvider.setPatientManagerIndex(2); - context.pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Existing MIH User", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 10), - MihButton( - onPressed: () { - Navigator.pop(context); - addAppointmentWindow( - profileProvider, mihCalendarProvider, width); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Skeleton Appointment", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ); - }, - ); - } - - void addAppointmentWindow(MzansiProfileProvider profileProvider, - MihCalendarProvider mihCalendarProvider, double width) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: "Add Appointment", - onWindowTapClose: () { - context.pop(); - _appointmentDateController.clear(); - _appointmentTimeController.clear(); - _appointmentTitleController.clear(); - _appointmentDescriptionIDController.clear(); - _patientController.clear(); - }, - windowBody: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.05) - : const EdgeInsets.symmetric(horizontal: 0), - child: Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: _appointmentTitleController, - multiLineInput: false, - requiredText: true, - hintText: "Appointment Title", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihDateField( - controller: _appointmentDateController, - labelText: "Date", - required: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTimeField( - controller: _appointmentTimeController, - labelText: "Time", - required: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - height: 250, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: _appointmentDescriptionIDController, - multiLineInput: true, - requiredText: true, - hintText: "Description", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 20), - Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - addAppointmentCall( - profileProvider, mihCalendarProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Add", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ], - ), - ), - ); - }, - ); - } - - Future addAppointmentCall(MzansiProfileProvider profileProvider, - MihCalendarProvider mihCalendarProvider) async { - if (isAppointmentInputValid()) { - int statusCode; - statusCode = await MihMzansiCalendarApis.addBusinessAppointment( - profileProvider.user!, - profileProvider.business!, - profileProvider.businessUser!, - true, - _appointmentTitleController.text, - _appointmentDescriptionIDController.text, - _appointmentDateController.text, - _appointmentTimeController.text, - mihCalendarProvider, - context, - ); - - if (statusCode == 201) { - context.pop(); - successPopUp("Successfully Added Appointment", - "You appointment has been successfully added to your calendar."); - _loadInitialAppointments(); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } else { - MihAlertServices().inputErrorAlert(context); - } - checkforchange(); - } - - void successPopUp(String title, String message) { - MihAlertServices().successAdvancedAlert( - title, - message, - [ - MihButton( - onPressed: () { - context.pop(); - setState(() { - _appointmentDateController.clear(); - _appointmentTimeController.clear(); - _appointmentTitleController.clear(); - _appointmentDescriptionIDController.clear(); - }); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - bool isAppointmentInputValid() { - if (_appointmentDescriptionIDController.text.isEmpty || - _appointmentDateController.text.isEmpty || - _appointmentTimeController.text.isEmpty) { - return false; - } else { - return true; - } - } - - void checkforchange() { - setState(() { - isLoading = true; - }); - _loadInitialAppointments(); - } - - Future _loadInitialAppointments() async { - MzansiProfileProvider mzansiProfileProvider = - context.read(); - MihCalendarProvider mihCalendarProvider = - context.read(); - await MihMzansiCalendarApis.getBusinessAppointments( - mzansiProfileProvider.business!.business_id, - false, - mihCalendarProvider.selectedDay, - mihCalendarProvider, - ); - setState(() { - isLoading = false; - }); - } - - @override - void dispose() { - selectedAppointmentDateController.dispose(); - _appointmentDateController.dispose(); - _appointmentTimeController.dispose(); - _appointmentTitleController.dispose(); - _appointmentDescriptionIDController.dispose(); - super.dispose(); - } - - @override - void initState() { - selectedAppointmentDateController.addListener(checkforchange); - WidgetsBinding.instance.addPostFrameCallback((_) { - _loadInitialAppointments(); - }); - super.initState(); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBusinessAppointmentsTool(screenWidth), - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_manager/pat_manager.dart b/mih_ui/lib/mih_packages/patient_manager/pat_manager/pat_manager.dart deleted file mode 100644 index 0ac192b0..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_manager/pat_manager.dart +++ /dev/null @@ -1,159 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_manager/package_tools/mih_patient_search.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_manager/package_tools/my_patient_list.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_manager/package_tools/waiting_room.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_data_helper_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_calendar_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_patient_services.dart'; -import 'package:provider/provider.dart'; - -class PatManager extends StatefulWidget { - const PatManager({ - super.key, - }); - - @override - State createState() => _PatManagerState(); -} - -class _PatManagerState extends State { - bool _isLoadingInitialData = true; - late final WaitingRoom _waitingRoom; - late final MyPatientList _myPatientList; - late final MihPatientSearch _mihPatientSearch; - - Future _loadInitialData() async { - setState(() { - _isLoadingInitialData = true; - }); - MzansiProfileProvider mzansiProfileProvider = - context.read(); - PatientManagerProvider patientManagerProvider = - context.read(); - MihCalendarProvider mihCalendarProvider = - context.read(); - if (mzansiProfileProvider.user == null) { - await MihDataHelperServices().loadUserDataWithBusinessesData( - mzansiProfileProvider, - ); - } - patientManagerProvider.setPersonalMode(false); - if (mzansiProfileProvider.business != null) { - await MihMzansiCalendarApis.getBusinessAppointments( - mzansiProfileProvider.business!.business_id, - false, - mihCalendarProvider.selectedDay, - mihCalendarProvider, - ); - await MihPatientServices().getPatientAccessListOfBusiness( - patientManagerProvider, mzansiProfileProvider.business!.business_id); - } - setState(() { - _isLoadingInitialData = false; - }); - } - - @override - void initState() { - super.initState(); - _waitingRoom = WaitingRoom(); - _myPatientList = MyPatientList(); - _mihPatientSearch = MihPatientSearch(); - WidgetsBinding.instance.addPostFrameCallback((_) { - _loadInitialData(); - }); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: - (BuildContext context, PatientManagerProvider value, Widget? child) { - if (_isLoadingInitialData) { - return Scaffold( - body: Center( - child: Mihloadingcircle(), - ), - ); - } - return MihPackage( - appActionButton: getActionButton(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: getToolTitle(), - selectedbodyIndex: - context.watch().patientManagerIndex, - onIndexChange: (newValue) { - context - .read() - .setPatientManagerIndex(newValue); - }, - ); - }, - ); - } - - MihPackageAction getActionButton() { - PatientManagerProvider patientManagerProvider = - context.read(); - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - patientManagerProvider.setPatientProfileIndex(0); - patientManagerProvider.setPatientManagerIndex(0); - context.goNamed( - 'mihHome', - ); - FocusScope.of(context).unfocus(); - }, - ); - } - - MihPackageTools getTools() { - Map temp = {}; - temp[const Icon(Icons.calendar_month)] = () { - context.read().setPatientManagerIndex(0); - }; - temp[const Icon(Icons.check_box_outlined)] = () { - context.read().setPatientManagerIndex(1); - }; - - temp[const Icon(Icons.search)] = () { - context - .read() - .setPatientSearchResults(patientSearchResults: []); - context.read().setPatientManagerIndex(2); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: - context.watch().patientManagerIndex, - ); - } - - List getToolBody() { - return [ - _waitingRoom, - _myPatientList, - _mihPatientSearch, - ]; - } - - List getToolTitle() { - List toolTitles = [ - "Waiting Room", - "My Patients", - "Search Patients", - ]; - return toolTitles; - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/components/claim_statement_window.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/components/claim_statement_window.dart deleted file mode 100644 index b70857df..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/components/claim_statement_window.dart +++ /dev/null @@ -1,557 +0,0 @@ -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_claim_statement_generation_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_icd10_code_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_date_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_radio_options.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_objects/arguments.dart'; -import 'package:mzansi_innovation_hub/mih_objects/icd10_code.dart.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/components/icd10_search_window.dart'; -import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; -import 'package:provider/provider.dart'; - -class ClaimStatementWindow extends StatefulWidget { - const ClaimStatementWindow({ - super.key, - }); - - @override - State createState() => _ClaimStatementWindowState(); -} - -class _ClaimStatementWindowState extends State { - final TextEditingController _docTypeController = TextEditingController(); - final TextEditingController _fullNameController = TextEditingController(); - final TextEditingController _idController = TextEditingController(); - final TextEditingController _medAidController = TextEditingController(); - final TextEditingController _medAidNoController = TextEditingController(); - final TextEditingController _medAidCodeController = TextEditingController(); - final TextEditingController _medAidNameController = TextEditingController(); - final TextEditingController _medAidSchemeController = TextEditingController(); - final TextEditingController _providerNameController = TextEditingController(); - final TextEditingController _practiceNoController = TextEditingController(); - final TextEditingController _vatNoController = TextEditingController(); - final TextEditingController _serviceDateController = TextEditingController(); - final TextEditingController _serviceDescController = TextEditingController(); - final TextEditingController _serviceDescOptionsController = - TextEditingController(); - final TextEditingController _prcedureNameController = TextEditingController(); - // final TextEditingController _procedureDateController = - // TextEditingController(); - final TextEditingController _proceedureAdditionalInfoController = - TextEditingController(); - final TextEditingController _icd10CodeController = TextEditingController(); - final TextEditingController _amountController = TextEditingController(); - final TextEditingController _preauthNoController = TextEditingController(); - final ValueNotifier serviceDesc = ValueNotifier(""); - final ValueNotifier medAid = ValueNotifier(""); - List icd10codeList = []; - final FocusNode _searchFocusNode = FocusNode(); - final _formKey = GlobalKey(); - - void icd10SearchWindow(List codeList) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => ICD10SearchWindow( - icd10CodeController: _icd10CodeController, - icd10codeList: codeList, - ), - ); - } - - Widget getWindowBody(double width) { - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, Widget? child) { - return Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.05) - : const EdgeInsets.symmetric(horizontal: 0), - child: Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - MihRadioOptions( - controller: _docTypeController, - hintText: "Document Type", - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - secondaryFillColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - requiredText: true, - radioOptions: const ["Claim", "Statement"], - ), - const SizedBox(height: 10), - Center( - child: Text( - "Service Details", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark")), - const SizedBox(height: 10), - MihDateField( - controller: _serviceDateController, - labelText: "Date of Service", - required: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihRadioOptions( - controller: _serviceDescController, - hintText: "Serviced Description", - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - secondaryFillColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - requiredText: true, - radioOptions: const [ - "Consultation", - "Procedure", - "Other", - ], - ), - const SizedBox(height: 10), - ValueListenableBuilder( - valueListenable: serviceDesc, - builder: - (BuildContext context, String value, Widget? child) { - Widget returnWidget; - switch (value) { - case 'Consultation': - returnWidget = Column( - key: const ValueKey( - 'consultation_fields'), // Added key - children: [ - MihRadioOptions( - key: const ValueKey( - 'consultation_type_dropdown'), - controller: _serviceDescOptionsController, - hintText: "Consultation Type", - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - secondaryFillColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - requiredText: true, - radioOptions: const [ - "General Consultation", - "Follow-Up Consultation", - "Specialist Consultation", - "Emergency Consultation", - ], - ), - const SizedBox(height: 10), - ], - ); - break; - case 'Procedure': - returnWidget = Column( - key: - const ValueKey('procedure_fields'), // Added key - children: [ - MihTextFormField( - key: const ValueKey( - 'procedure_name_field'), // Added key - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - controller: _prcedureNameController, - multiLineInput: false, - requiredText: true, - hintText: "Procedure Name", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - MihTextFormField( - key: const ValueKey( - 'procedure_additional_info_field'), // Added key - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - controller: _proceedureAdditionalInfoController, - multiLineInput: false, - requiredText: true, - hintText: "Additional Procedure Information", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 15), - ], - ); - break; - case 'Other': - returnWidget = Column( - key: const ValueKey('other_fields'), // Added key - children: [ - MihTextFormField( - key: const ValueKey( - 'other_service_description_field'), // Added key - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - controller: _serviceDescOptionsController, - multiLineInput: false, - requiredText: true, - hintText: "Service Description Details", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - ], - ); - break; - default: - returnWidget = const SizedBox( - key: const ValueKey('empty_fields')); // Added key - } - return returnWidget; - }, - ), - Column( - children: [ - Align( - alignment: Alignment.centerLeft, - child: Text("ICD-10 Code & Description", - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - )), - ), - const SizedBox(height: 4), - MihSearchBar( - controller: _icd10CodeController, - hintText: "ICD-10 Search", - prefixIcon: Icons.search, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - hintColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onPrefixIconTap: () { - MIHIcd10CodeApis.getIcd10Codes( - _icd10CodeController.text, context) - .then((result) { - icd10SearchWindow(result); - }); - }, - onClearIconTap: () { - _icd10CodeController.clear(); - }, - searchFocusNode: _searchFocusNode, - ), - ], - ), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: _amountController, - multiLineInput: false, - requiredText: true, - numberMode: true, - hintText: "Service Cost", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10), - Center( - child: Text( - "Additional Infomation", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark")), - const SizedBox(height: 10), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: _preauthNoController, - multiLineInput: false, - requiredText: false, - hintText: "Pre-authorisation No.", - ), - const SizedBox(height: 20), - Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - if (isInputValid()) { - MIHClaimStatementGenerationApi() - .generateClaimStatement( - profileProvider, - patientManagerProvider, - ClaimStatementGenerationArguments( - _docTypeController.text, - patientManagerProvider - .selectedPatient!.app_id, - _fullNameController.text, - _idController.text, - _medAidController.text, - _medAidNoController.text, - _medAidCodeController.text, - _medAidNameController.text, - _medAidSchemeController.text, - profileProvider.business!.Name, - "*To-Be Added*", - profileProvider.business!.contact_no, - profileProvider.business!.bus_email, - _providerNameController.text, - _practiceNoController.text, - _vatNoController.text, - _serviceDateController.text, - _serviceDescController.text, - _serviceDescOptionsController.text, - _prcedureNameController.text, - _proceedureAdditionalInfoController.text, - _icd10CodeController.text, - _amountController.text, - _preauthNoController.text, - profileProvider.business!.logo_path, - profileProvider.businessUser!.sig_path, - ), - AppEnviroment.getEnv(), - context); - } else { - MihAlertServices().inputErrorAlert(context); - } - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Generate", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ], - ), - ); - }, - ); - } - - void serviceDescriptionSelected() { - String selectedType = _serviceDescController.text; - serviceDesc.value = selectedType; - if (selectedType == 'Consultation') { - _prcedureNameController.clear(); - _proceedureAdditionalInfoController.clear(); - } else if (selectedType == 'Procedure') { - _serviceDescOptionsController.clear(); - } else if (selectedType == 'Other') { - _prcedureNameController.clear(); - _proceedureAdditionalInfoController.clear(); - } else { - _prcedureNameController.clear(); - _proceedureAdditionalInfoController.clear(); - _serviceDescOptionsController.clear(); - } - } - - void hasMedAid() { - if (_medAidController.text.isNotEmpty) { - } else { - medAid.value = ""; - } - } - - bool isInputValid() { - if (_docTypeController.text.isEmpty || - _serviceDateController.text.isEmpty || - _icd10CodeController.text.isEmpty || - _amountController.text.isEmpty) { - return false; - } - switch (_serviceDescController.text) { - case 'Consultation': - case 'Other': - if (_serviceDescOptionsController.text.isEmpty) { - return false; - } - break; - case 'Procedure': - if (_prcedureNameController.text.isEmpty || - _proceedureAdditionalInfoController.text.isEmpty) { - return false; - } - break; - default: - return false; - } - return true; - } - - String getUserTitle(MzansiProfileProvider profileProvider) { - if (profileProvider.businessUser!.title == "Doctor") { - return "Dr."; - } else { - return profileProvider.businessUser!.title; - } - } - - String getTodayDate() { - DateTime today = DateTime.now(); - return DateFormat('yyyy-MM-dd').format(today); - } - - @override - void dispose() { - _docTypeController.dispose(); - _fullNameController.dispose(); - _idController.dispose(); - _medAidController.dispose(); - _medAidNoController.dispose(); - _medAidCodeController.dispose(); - _medAidNameController.dispose(); - _medAidSchemeController.dispose(); - _providerNameController.dispose(); - _practiceNoController.dispose(); - _vatNoController.dispose(); - _serviceDateController.dispose(); - _serviceDescController.dispose(); - _serviceDescOptionsController.dispose(); - _prcedureNameController.dispose(); - // _procedureDateController.dispose(); - _proceedureAdditionalInfoController.dispose(); - _icd10CodeController.dispose(); - _preauthNoController.dispose(); - _searchFocusNode.dispose(); - serviceDesc.dispose(); - medAid.dispose(); - super.dispose(); - } - - @override - void initState() { - super.initState(); - PatientManagerProvider patientManagerProvider = - context.read(); - MzansiProfileProvider profileProvider = - context.read(); - _serviceDescController.text = "Consultation"; - _serviceDescController.addListener(serviceDescriptionSelected); - serviceDesc.value = "Consultation"; - _medAidController.addListener(hasMedAid); - _fullNameController.text = - "${patientManagerProvider.selectedPatient!.first_name} ${patientManagerProvider.selectedPatient!.last_name}"; - _idController.text = patientManagerProvider.selectedPatient!.id_no; - _medAidController.text = - patientManagerProvider.selectedPatient!.medical_aid; - _medAidNameController.text = - patientManagerProvider.selectedPatient!.medical_aid_name; - _medAidCodeController.text = - patientManagerProvider.selectedPatient!.medical_aid_code; - _medAidNoController.text = - patientManagerProvider.selectedPatient!.medical_aid_no; - _medAidSchemeController.text = - patientManagerProvider.selectedPatient!.medical_aid_scheme; - _serviceDateController.text = getTodayDate(); - _providerNameController.text = - "${getUserTitle(profileProvider)} ${profileProvider.user!.fname} ${profileProvider.user!.lname}"; - _practiceNoController.text = profileProvider.business!.practice_no; - _vatNoController.text = profileProvider.business!.vat_no; - hasMedAid(); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageWindow( - fullscreen: false, - windowTitle: "Generate Claim/ Statement Document", - onWindowTapClose: () { - Navigator.pop(context); - }, - windowBody: getWindowBody(screenWidth), - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/components/icd10_search_window.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/components/icd10_search_window.dart deleted file mode 100644 index 59d25a3b..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/components/icd10_search_window.dart +++ /dev/null @@ -1,79 +0,0 @@ -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_objects/icd10_code.dart.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/list_builders/build_icd10_code_list.dart'; -import 'package:flutter/material.dart'; - -class ICD10SearchWindow extends StatefulWidget { - final TextEditingController icd10CodeController; - final List icd10codeList; - const ICD10SearchWindow({ - super.key, - required this.icd10CodeController, - required this.icd10codeList, - }); - - @override - State createState() => _ICD10SearchWindowState(); -} - -class _ICD10SearchWindowState extends State { - Widget getWindowBody() { - return Column( - children: [ - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: widget.icd10CodeController, - multiLineInput: false, - requiredText: true, - numberMode: true, - hintText: "ICD-10 Code Searched", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 15), - Text( - "Search for ICD-10 Codes", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark")), - BuildICD10CodeList( - icd10CodeController: widget.icd10CodeController, - icd10codeList: widget.icd10codeList, - ), - ], - ); - } - - @override - Widget build(BuildContext context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: "ICD-10 Search", - onWindowTapClose: () { - // medicineController.clear(); - // quantityController.clear(); - // dosageController.clear(); - // timesDailyController.clear(); - // noDaysController.clear(); - // noRepeatsController.clear(); - Navigator.pop(context); - }, - windowBody: getWindowBody(), - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/components/medicine_search.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/components/medicine_search.dart deleted file mode 100644 index ab3a5d0d..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/components/medicine_search.dart +++ /dev/null @@ -1,103 +0,0 @@ -import 'dart:convert'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_objects/medicine.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/list_builders/build_med_list.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; - -import 'package:supertokens_flutter/http.dart' as http; - -class MedicineSearch extends StatefulWidget { - final TextEditingController searchVlaue; - const MedicineSearch({ - super.key, - required this.searchVlaue, - }); - - @override - State createState() => _MedicineSearchState(); -} - -class _MedicineSearchState extends State { - final String endpointMeds = "${AppEnviroment.baseApiUrl}/users/medicine/"; - - //TextEditingController searchController = TextEditingController(); - - late Future> futueMeds; - //String searchString = ""; - - Future> getMedList(String endpoint) async { - final response = await http.get(Uri.parse(endpoint)); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List medicines = - List.from(l.map((model) => Medicine.fromJson(model))); - // List meds = []; - // medicines.forEach((element) => meds.add(element.name)); - return medicines; - } else { - MihAlertServices().internetConnectionAlert(context); - throw Exception('failed to load medicine'); - } - } - - @override - void dispose() { - super.dispose(); - } - - @override - void initState() { - futueMeds = getMedList(endpointMeds + widget.searchVlaue.text); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: "Select Medicine", - onWindowTapClose: () { - Navigator.pop(context); - }, - windowBody: Column( - children: [ - FutureBuilder( - future: futueMeds, - builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - return const SizedBox( - height: 400, - child: Mihloadingcircle(), - ); - } else if (snapshot.hasData && snapshot.data!.isNotEmpty) { - final medsList = snapshot.data!; - return SizedBox( - height: 400, - child: BuildMedicinesList( - contoller: widget.searchVlaue, - medicines: medsList, - //searchString: searchString, - ), - ); - } else { - return const SizedBox( - height: 400, - child: Center( - child: Text( - "No Match Found\nPlease close and manually capture medicine", - style: TextStyle(fontSize: 25, color: Colors.grey), - textAlign: TextAlign.center, - ), - ), - ); - } - }, - ), - ], - ), - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/components/mih_edit_patient_details_window.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/components/mih_edit_patient_details_window.dart deleted file mode 100644 index afbada89..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/components/mih_edit_patient_details_window.dart +++ /dev/null @@ -1,518 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_toggle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_patient_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:provider/provider.dart'; - -class MihEditPatientDetailsWindow extends StatefulWidget { - const MihEditPatientDetailsWindow({super.key}); - - @override - State createState() => - _MihEditPatientDetailsWindowState(); -} - -class _MihEditPatientDetailsWindowState - extends State { - var idController = TextEditingController(); - final fnameController = TextEditingController(); - final lnameController = TextEditingController(); - final cellController = TextEditingController(); - final emailController = TextEditingController(); - final medNoController = TextEditingController(); - final medNameController = TextEditingController(); - final medSchemeController = TextEditingController(); - final addressController = TextEditingController(); - final medAidController = TextEditingController(); - final medMainMemController = TextEditingController(); - final medAidCodeController = TextEditingController(); - final FocusNode _focusNode = FocusNode(); - final _formKey = GlobalKey(); - late bool medAidPosition; - late bool medMainMemberPosition; - final ValueNotifier medRequired = ValueNotifier(false); - - Future updatePatientApiCall( - PatientManagerProvider patientManagerProvider) async { - var statusCode = await MihPatientServices().updatePatientService( - patientManagerProvider.selectedPatient!.app_id, - idController.text, - fnameController.text, - lnameController.text, - emailController.text, - cellController.text, - medAidController.text, - medMainMemController.text, - medNoController.text, - medAidCodeController.text, - medNameController.text, - medSchemeController.text, - addressController.text, - patientManagerProvider, - ); - if (statusCode == 200) { - successPopUp( - "Successfully Updated Profile!", - "${fnameController.text} ${lnameController.text}'s information has been updated successfully! Their medical records and details are now current.", - ); - } else { - MihAlertServices().errorBasicAlert( - "Error Updating Profile", - "There was an error updating your profile. Please try again later.", - context, - ); - } - } - - void successPopUp(String title, String message) { - MihAlertServices().successAdvancedAlert( - title, - message, - [ - MihButton( - onPressed: () { - context.pop(); - context.pop(); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - Widget displayForm( - PatientManagerProvider patientManagerProvider, double width) { - return SingleChildScrollView( - child: Padding( - padding: MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.05) - : const EdgeInsets.symmetric(horizontal: 0), - child: Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "Personal", - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25.0, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ], - ), - Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark")), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: idController, - multiLineInput: false, - requiredText: true, - hintText: "ID No.", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: fnameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "First Name", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: lnameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Surname", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: cellController, - multiLineInput: false, - requiredText: true, - hintText: "Cell No.", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: emailController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Email", - validator: (value) { - return MihValidationServices().validateEmail(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - height: 100, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: addressController, - multiLineInput: true, - requiredText: true, - hintText: "Address", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 15.0), - Center( - child: Text( - "Medical Aid Details", - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25.0, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark")), - const SizedBox(height: 10.0), - MihToggle( - hintText: "Medical Aid", - initialPostion: medAidPosition, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - secondaryFillColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onChange: (value) { - if (value) { - setState(() { - medAidController.text = "Yes"; - medAidPosition = value; - }); - } else { - setState(() { - medAidController.text = "No"; - medAidPosition = value; - }); - } - }, - ), - ValueListenableBuilder( - valueListenable: medRequired, - builder: (BuildContext context, bool value, Widget? child) { - return Visibility( - visible: value, - child: Column( - children: [ - const SizedBox(height: 10.0), - MihToggle( - hintText: "Main Member", - initialPostion: medMainMemberPosition, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - secondaryFillColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onChange: (value) { - if (value) { - setState(() { - medMainMemController.text = "Yes"; - medMainMemberPosition = value; - }); - } else { - setState(() { - medMainMemController.text = "No"; - medMainMemberPosition = value; - }); - } - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: medNoController, - multiLineInput: false, - requiredText: true, - hintText: "No.", - validator: (validationValue) { - if (value) { - return MihValidationServices() - .isEmpty(validationValue); - } - return null; - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: medAidCodeController, - multiLineInput: false, - requiredText: true, - hintText: "Code", - validator: (validationValue) { - if (value) { - return MihValidationServices() - .isEmpty(validationValue); - } - return null; - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: medNameController, - multiLineInput: false, - requiredText: true, - hintText: "Name", - validator: (validationValue) { - if (value) { - return MihValidationServices() - .isEmpty(validationValue); - } - return null; - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: medSchemeController, - multiLineInput: false, - requiredText: true, - hintText: "Plan", - validator: (validationValue) { - if (value) { - return MihValidationServices() - .isEmpty(validationValue); - } - return null; - }, - ), - const SizedBox(height: 10.0), - ], - ), - ); - }, - ), - const SizedBox(height: 20.0), - Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - updatePatientApiCall(patientManagerProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Update", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - const SizedBox(height: 20.0), - ], - ), - ], - ), - ), - ); - } - - void isRequired() { - if (medAidController.text == "Yes") { - medRequired.value = true; - } else if (medAidController.text == "No") { - medRequired.value = false; - } else {} - } - - @override - void dispose() { - idController.dispose(); - fnameController.dispose(); - lnameController.dispose(); - cellController.dispose(); - emailController.dispose(); - medNoController.dispose(); - medNameController.dispose(); - medSchemeController.dispose(); - addressController.dispose(); - medAidController.dispose(); - medAidCodeController.removeListener(isRequired); - medMainMemController.dispose(); - medAidCodeController.dispose(); - medRequired.dispose(); - _focusNode.dispose(); - super.dispose(); - } - - @override - void initState() { - medAidController.addListener(isRequired); - PatientManagerProvider patientManagerProvider = - context.read(); - setState(() { - idController.text = patientManagerProvider.selectedPatient!.id_no; - fnameController.text = patientManagerProvider.selectedPatient!.first_name; - lnameController.text = patientManagerProvider.selectedPatient!.last_name; - cellController.text = patientManagerProvider.selectedPatient!.cell_no; - emailController.text = patientManagerProvider.selectedPatient!.email; - medNameController.text = - patientManagerProvider.selectedPatient!.medical_aid_name; - medNoController.text = - patientManagerProvider.selectedPatient!.medical_aid_no; - medSchemeController.text = - patientManagerProvider.selectedPatient!.medical_aid_scheme; - addressController.text = patientManagerProvider.selectedPatient!.address; - medAidController.text = - patientManagerProvider.selectedPatient!.medical_aid; - medMainMemController.text = - patientManagerProvider.selectedPatient!.medical_aid_main_member; - medAidCodeController.text = - patientManagerProvider.selectedPatient!.medical_aid_code; - }); - if (medAidController.text == "Yes") { - medAidPosition = true; - } else { - medAidPosition = false; - medAidController.text = "No"; - } - if (medMainMemController.text == "Yes") { - medMainMemberPosition = true; - } else { - medMainMemberPosition = false; - medMainMemController.text = "No"; - } - super.initState(); - } - - @override - Widget build(BuildContext context) { - var size = MediaQuery.of(context).size; - return MihPackageWindow( - fullscreen: false, - windowTitle: "Edit Patient Details", - onWindowTapClose: () { - context.pop(); - }, - windowBody: getBody(size.width), - ); - } - - Widget getBody(double width) { - return Consumer( - builder: (BuildContext context, - PatientManagerProvider patientManagerProvider, Widget? child) { - return KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - if (_formKey.currentState!.validate()) { - updatePatientApiCall(patientManagerProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - } - }, - child: displayForm(patientManagerProvider, width), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/components/prescip_input.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/components/prescip_input.dart deleted file mode 100644 index cde00c8e..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/components/prescip_input.dart +++ /dev/null @@ -1,580 +0,0 @@ -import 'dart:convert'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_numeric_stepper.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/components/medicine_search.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business_user.dart'; -import 'package:mzansi_innovation_hub/mih_objects/patients.dart'; -import 'package:mzansi_innovation_hub/mih_objects/perscription.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_patient_services.dart'; -import 'package:provider/provider.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class PrescripInput extends StatefulWidget { - final TextEditingController medicineController; - final TextEditingController quantityController; - final TextEditingController dosageController; - final TextEditingController timesDailyController; - final TextEditingController noDaysController; - final TextEditingController noRepeatsController; - final TextEditingController outputController; - final Patient selectedPatient; - final AppUser signedInUser; - final Business? business; - final BusinessUser? businessUser; - final String env; - const PrescripInput({ - super.key, - required this.medicineController, - required this.quantityController, - required this.dosageController, - required this.timesDailyController, - required this.noDaysController, - required this.noRepeatsController, - required this.outputController, - required this.selectedPatient, - required this.signedInUser, - required this.business, - required this.businessUser, - required this.env, - }); - - @override - State createState() => _PrescripInputState(); -} - -class _PrescripInputState extends State { - final FocusNode _focusNode = FocusNode(); - final FocusNode _searchFocusNode = FocusNode(); - final _formKey = GlobalKey(); - List perscriptionObjOutput = []; - late double width; - late double height; - - final numberOptions = [ - "0", - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "10", - "11", - "12", - "13", - "14", - "15", - "16", - "17", - "18", - "19", - "20", - "21", - "22", - "23", - "24", - "25", - "26", - "27", - "28", - "29", - "30" - ]; - - Future generatePerscription( - PatientManagerProvider patManProvider, - ) async { - //start loading circle - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - DateTime now = DateTime.now(); - // DateTime date = new DateTime(now.year, now.month, now.day); - String fileName = - "Perscription-${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}-${now.toString().substring(0, 19)}.pdf" - .replaceAll(RegExp(r' '), '-'); - var response1 = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/minio/generate/perscription/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "app_id": widget.selectedPatient.app_id, - "env": widget.env, - "patient_full_name": - "${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}", - "fileName": fileName, - "id_no": widget.selectedPatient.id_no, - "docfname": - "DR. ${widget.signedInUser.fname} ${widget.signedInUser.lname}", - "busName": widget.business!.Name, - "busAddr": "*TO BE ADDED IN THE FUTURE*", - "busNo": widget.business!.contact_no, - "busEmail": widget.business!.bus_email, - "logo_path": widget.business!.logo_path, - "sig_path": widget.businessUser!.sig_path, - "data": perscriptionObjOutput, - }), - ); - //print(response1.statusCode); - if (response1.statusCode == 200) { - var response2 = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/patient_files/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "file_path": - "${widget.selectedPatient.app_id}/patient_files/$fileName", - "file_name": fileName, - "app_id": widget.selectedPatient.app_id - }), - ); - //print(response2.statusCode); - if (response2.statusCode == 201) { - //To do - widget.medicineController.clear(); - widget.dosageController.clear(); - widget.timesDailyController.clear(); - widget.noDaysController.clear(); - widget.timesDailyController.clear(); - widget.noRepeatsController.clear(); - widget.quantityController.clear(); - widget.outputController.clear(); - // futueFiles = fetchFiles(); - // end loading circle - context.pop(); - context.pop(); - String message = - "The perscription $fileName has been successfully generated and added to ${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}'s record. You can now access and download it for their use."; - - await MihPatientServices().getPatientDocuments(patManProvider); - MihAlertServices().successBasicAlert( - "Success!", - message, - context, - ); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - void getMedsPopUp(TextEditingController medSearch) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return MedicineSearch( - searchVlaue: medSearch, - ); - }, - ); - } - - bool isFieldsFilled() { - if (widget.medicineController.text.isEmpty) { - return false; - } else { - return true; - } - } - - void updatePerscriptionList() { - String name; - String unit; - String form; - List medNameList = widget.medicineController.text.split("%t"); - if (medNameList.length == 1) { - name = medNameList[0]; - unit = ""; - form = ""; - } else { - name = medNameList[0]; - unit = medNameList[1]; - form = medNameList[2]; - } - int quantityCalc = calcQuantity( - widget.dosageController.text, - widget.timesDailyController.text, - widget.noDaysController.text, - medNameList[2].toLowerCase()); - Perscription tempObj = Perscription( - name: name, - unit: unit, - form: form, - fullForm: getFullDoagesForm(form), - quantity: "$quantityCalc", - dosage: widget.dosageController.text, - times: widget.timesDailyController.text, - days: widget.noDaysController.text, - repeats: widget.noRepeatsController.text, - ); - perscriptionObjOutput.add(tempObj); - } - - String getPerscTitle(int index) { - return "${perscriptionObjOutput[index].name} - ${perscriptionObjOutput[index].form}"; - } - - String getPerscSubtitle(int index) { - if (perscriptionObjOutput[index].form.toLowerCase() == "syr") { - String unit = perscriptionObjOutput[index].unit.toLowerCase(); - if (perscriptionObjOutput[index].unit.toLowerCase().contains("ml")) { - unit = "ml"; - } - return "${perscriptionObjOutput[index].dosage} $unit, ${perscriptionObjOutput[index].times} time(s) daily, for ${perscriptionObjOutput[index].days} day(s)\nQuantity: ${perscriptionObjOutput[index].quantity}\nNo. of repeats: ${perscriptionObjOutput[index].repeats}"; - } else { - return "${perscriptionObjOutput[index].dosage} ${perscriptionObjOutput[index].fullForm}(s), ${perscriptionObjOutput[index].times} time(s) daily, for ${perscriptionObjOutput[index].days} day(s)\nQuantity: ${perscriptionObjOutput[index].quantity}\nNo. of repeats: ${perscriptionObjOutput[index].repeats}"; - } - } - - String getFullDoagesForm(String abr) { - var dosageFormList = { - "liq": "liquid", - "tab": "tablet", - "cap": "capsule", - "cps": "capsule", - "oin": "ointment", - "lit": "lotion", - "lot": "lotion", - "inj": "injection", - "syr": "syrup", - "dsp": "effervescent tablet", - "eft": "effervescent tablet", - "ear": "drops", - "drp": "drops", - "opd": "drops", - "udv": "vial", - "sus": "suspension", - "susp": "suspension", - "cal": "calasthetic", - "sol": "solution", - "sln": "solution", - "neb": "nebuliser", - "inh": "inhaler", - "spo": "inhaler", - "inf": "infusion", - "chg": "chewing Gum", - "vac": "vacutainer", - "vag": "vaginal gel", - "jel": "gel", - "eyo": "eye ointment", - "vat": "vaginal cream", - "poi": "injection", - "ped": "powder", - "pow": "powder", - "por": "powder", - "sac": "sachet", - "sup": "suppository", - "cre": "cream", - "ptd": "patch", - "ect": "tablet", - "nas": "spray", - }; - String form; - if (dosageFormList[abr.toLowerCase()] == null) { - form = abr; - } else { - form = dosageFormList[abr.toLowerCase()]!; - } - return form; - } - - int calcQuantity(String dosage, String times, String days, String form) { - var dosageFormList = [ - "tab", - "cap", - "cps", - "dsp", - "eft", - "udv", - "chg", - "sac", - "sup", - "ptd", - "ect", - ]; - if (dosageFormList.contains(form)) { - return int.parse(dosage) * int.parse(times) * int.parse(days); - } else { - return 1; - } - } - - Widget displayMedInput() { - return Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - Column( - children: [ - Align( - alignment: Alignment.centerLeft, - child: Text( - "Medication", - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - const SizedBox(height: 4), - MihSearchBar( - controller: widget.medicineController, - hintText: "Search Medicine", - prefixIcon: Icons.search, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - hintColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onPrefixIconTap: () { - getMedsPopUp(widget.medicineController); - }, - onClearIconTap: () { - widget.medicineController.clear(); - }, - searchFocusNode: _searchFocusNode, - ), - ], - ), - const SizedBox(height: 10.0), - MihNumericStepper( - controller: widget.dosageController, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - hintText: "Dosage", - requiredText: true, - minValue: 1, - // maxValue: 5, - validationOn: true, - ), - const SizedBox(height: 10.0), - MihNumericStepper( - controller: widget.timesDailyController, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - hintText: "Times Daily", - requiredText: true, - minValue: 1, - // maxValue: 5, - validationOn: true, - ), - const SizedBox(height: 10.0), - MihNumericStepper( - controller: widget.noDaysController, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - hintText: "No. Days", - requiredText: true, - minValue: 1, - // maxValue: 5, - validationOn: true, - ), - const SizedBox(height: 10.0), - MihNumericStepper( - controller: widget.noRepeatsController, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - hintText: "No.Repeats", - requiredText: true, - minValue: 0, - // maxValue: 5, - validationOn: true, - ), - const SizedBox(height: 15.0), - Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - if (isFieldsFilled()) { - setState(() { - updatePerscriptionList(); - widget.medicineController.clear(); - widget.quantityController.text = "1"; - widget.dosageController.text = "1"; - widget.timesDailyController.text = "1"; - widget.noDaysController.text = "1"; - widget.noRepeatsController.text = "0"; - }); - } else { - MihAlertServices().inputErrorAlert(context); - } - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Add", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ) - ], - ); - } - - Widget displayPerscList(PatientManagerProvider patManProvider) { - return Column( - children: [ - Container( - width: 550, - height: 325, - decoration: BoxDecoration( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(25.0), - border: Border.all( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 3.0), - ), - child: ListView.separated( - separatorBuilder: (BuildContext context, int index) { - return const Padding( - padding: EdgeInsets.symmetric(horizontal: 10.0), - child: Divider(), - ); - }, - itemCount: perscriptionObjOutput.length, - itemBuilder: (context, index) { - //final patient = widget.patients[index].id_no.contains(widget.searchString); - return ListTile( - title: Text( - getPerscTitle(index), - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - subtitle: Text( - getPerscSubtitle(index), - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - //onTap: () {}, - trailing: IconButton( - icon: Icon( - Icons.delete_forever_outlined, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - onPressed: () { - setState(() { - perscriptionObjOutput.removeAt(index); - }); - }, - ), - ); - }, - ), - ), - const SizedBox(height: 15.0), - MihButton( - onPressed: () async { - if (perscriptionObjOutput.isNotEmpty) { - //print(jsonEncode(perscriptionObjOutput)); - await generatePerscription(patManProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Generate", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ); - } - - @override - void dispose() { - _focusNode.dispose(); - _searchFocusNode.dispose(); - super.dispose(); - } - - @override - void initState() { - //futueMeds = getMedList(endpointMeds); - super.initState(); - } - - @override - Widget build(BuildContext context) { - var size = MediaQuery.of(context).size; - width = size.width; - height = size.height; - return Consumer( - builder: (BuildContext context, PatientManagerProvider patManProvider, - Widget? child) { - return Wrap( - direction: Axis.horizontal, - alignment: WrapAlignment.center, - spacing: 10, - runSpacing: 10, - // mainAxisAlignment: MainAxisAlignment.center, - // mainAxisSize: MainAxisSize.max, - // crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox(width: 500, child: displayMedInput()), - displayPerscList(patManProvider), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_claim_statement_files_list.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_claim_statement_files_list.dart deleted file mode 100644 index 115c6963..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_claim_statement_files_list.dart +++ /dev/null @@ -1,415 +0,0 @@ -import 'dart:async'; - -import 'package:fl_downloader/fl_downloader.dart'; -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_file_viewer_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_objects/arguments.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/list_builders/build_file_view.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:supertokens_flutter/http.dart' as http; -import 'package:http/http.dart' as http2; -import "package:universal_html/html.dart" as html; - -class BuildClaimStatementFileList extends StatefulWidget { - const BuildClaimStatementFileList({ - super.key, - }); - - @override - State createState() => - _BuildClaimStatementFileListState(); -} - -class _BuildClaimStatementFileListState - extends State { - int indexOn = 0; - final baseAPI = AppEnviroment.baseApiUrl; - final basefile = AppEnviroment.baseFileUrl; - String fileUrl = ""; - int progress = 0; - late StreamSubscription progressStream; - - Future getFileUrlApiCall(String filePath) async { - String teporaryFileUrl = ""; - await MihFileApi.getMinioFileUrl( - filePath, - ).then((value) { - teporaryFileUrl = value; - }); - return teporaryFileUrl; - } - - String getFileName(String path) { - //print(pdfLink.split(".")[1]); - return path.split("/").last; - } - - void printDocument(String link, String path) async { - http2.Response response = await http.get(Uri.parse(link)); - var pdfData = response.bodyBytes; - context.pop(); - context.pushNamed( - 'printPreview', - extra: PrintPreviewArguments( - pdfData, - getFileName(path), - ), - ); - // Navigator.of(context).pushNamed( - // '/file-veiwer/print-preview', - // arguments: PrintPreviewArguments( - // pdfData, - // getFileName(path), - // ), - // ); - } - - void nativeFileDownload(String fileLink) async { - var permission = await FlDownloader.requestPermission(); - if (permission == StoragePermissionStatus.granted) { - try { - mihLoadingPopUp(); - await FlDownloader.download(fileLink); - Navigator.of(context).pop(); - } on Exception catch (error) { - Navigator.of(context).pop(); - print(error); - } - } else { - print("denied"); - } - } - - void viewFilePopUp(PatientManagerProvider patientManagerProvider, - String fileName, String filePath, int fileID, String url) { - bool hasAccessToDelete = false; - if (!patientManagerProvider.personalMode) { - hasAccessToDelete = true; - } - - List? menuList = [ - SpeedDialChild( - child: Icon( - Icons.download, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Download", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - if (MzansiInnovationHub.of(context)!.theme.getPlatform() == "Web") { - html.window.open(url, 'download'); - } else { - nativeFileDownload(url); - } - }, - ), - ]; - menuList.add( - SpeedDialChild( - child: Icon( - Icons.print, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Print", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - printDocument(url, filePath); - }, - ), - ); - menuList.add( - SpeedDialChild( - child: Icon( - Icons.fullscreen, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Full Screen", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - context.pop(); - context.pushNamed( - 'fileViewer', - ); - // printDocument(url, filePath); - }, - ), - ); - - if (hasAccessToDelete) { - menuList.add( - SpeedDialChild( - child: Icon( - Icons.delete, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Delete Document", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - // deleteFilePopUp(filePath, fileID); - }, - ), - ); - } - - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: fileName, - windowBody: Column( - children: [ - BuildFileView( - link: url, - path: filePath, - //pdfLink: '${AppEnviroment.baseFileUrl}/mih/$filePath', - ), - const SizedBox( - height: 10, - ) - ], - ), - menuOptions: menuList, - onWindowTapClose: () { - Navigator.pop(context); - }, - ), - ); - } - - void mihLoadingPopUp() { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - } - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - } - - @override - void initState() { - super.initState(); - FlDownloader.initialize(); - progressStream = FlDownloader.progressStream.listen((event) { - if (event.status == DownloadStatus.successful) { - setState(() { - progress = event.progress; - }); - //Navigator.of(context).pop(); - print("Progress $progress%: Success Downloading"); - FlDownloader.openFile(filePath: event.filePath); - } else if (event.status == DownloadStatus.failed) { - print("Progress $progress%: Error Downloading"); - } else if (event.status == DownloadStatus.running) { - print("Progress $progress%: Download Running"); - } - }); - } - - @override - Widget build(BuildContext context) { - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, Widget? child) { - if (patientManagerProvider.patientClaimsDocuments!.isNotEmpty) { - return ListView.separated( - separatorBuilder: (BuildContext context, int index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemCount: patientManagerProvider.patientClaimsDocuments!.length, - itemBuilder: (context, index) { - return ListTile( - leading: Icon( - Icons.picture_as_pdf, - size: 50, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - title: Text( - patientManagerProvider - .patientClaimsDocuments![index].file_name, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - subtitle: Text( - patientManagerProvider - .patientClaimsDocuments![index].insert_date, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - // trailing: Icon( - // Icons.arrow_forward, - // color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - onTap: () async { - MihFileViewerProvider fileViewerProvider = - context.read(); - await getFileUrlApiCall(patientManagerProvider - .patientClaimsDocuments![index].file_path) - .then((urlHere) { - //print(url); - fileViewerProvider.setFilePath(patientManagerProvider - .patientClaimsDocuments![index].file_path); - fileViewerProvider.setFileLink(urlHere); - }); - - viewFilePopUp( - patientManagerProvider, - patientManagerProvider - .patientClaimsDocuments![index].file_name, - patientManagerProvider - .patientClaimsDocuments![index].file_path, - patientManagerProvider.patientClaimsDocuments![index] - .idclaim_statement_file, - fileViewerProvider.fileLink); - }, - ); - }, - ); - } else { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - const SizedBox(height: 50), - Stack( - alignment: AlignmentDirectional.center, - children: [ - Icon( - MihIcons.mihRing, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - Icon( - Icons.file_open_outlined, - size: 110, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ], - ), - const SizedBox(height: 10), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Text( - "No Claims or Statements have been added to this profile.", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - ], - ), - const SizedBox(height: 25), - Visibility( - visible: !patientManagerProvider.personalMode, - child: Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - Icons.menu, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - TextSpan(text: " to generate the first document"), - ], - ), - ), - ), - ), - ], - ), - ); - } - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_file_view.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_file_view.dart deleted file mode 100644 index e78add87..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_file_view.dart +++ /dev/null @@ -1,144 +0,0 @@ -import 'dart:async'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_objects/arguments.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:syncfusion_flutter_core/theme.dart'; -import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart'; -import 'package:http/http.dart' as http; -import 'package:fl_downloader/fl_downloader.dart'; - -class BuildFileView extends StatefulWidget { - final String link; - final String path; - - const BuildFileView({ - super.key, - required this.link, - required this.path, - }); - - @override - State createState() => _BuildFileViewState(); -} - -class _BuildFileViewState extends State { - late PdfViewerController pdfViewerController = PdfViewerController(); - //late TextEditingController currentPageController = TextEditingController(); - double startZoomLevel = 1; - - int progress = 0; - late StreamSubscription progressStream; - - void mihLoadingPopUp() { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - } - - String getExtType(String path) { - //print(pdfLink.split(".")[1]); - return path.split(".").last; - } - - String getFileName(String path) { - //print(pdfLink.split(".")[1]); - return path.split("/").last; - } - - void printDocument() async { - print("Printing ${widget.path.split("/").last}"); - http.Response response = await http.get(Uri.parse(widget.link)); - var pdfData = response.bodyBytes; - Navigator.of(context).pushNamed( - '/file-veiwer/print-preview', - arguments: PrintPreviewArguments( - pdfData, - getFileName( - widget.path, - ), - ), - ); - } - - void nativeFileDownload(String fileLink) async { - var permission = await FlDownloader.requestPermission(); - if (permission == StoragePermissionStatus.granted) { - try { - mihLoadingPopUp(); - await FlDownloader.download(fileLink); - Navigator.of(context).pop(); - } on Exception catch (error) { - Navigator.of(context).pop(); - print(error); - } - } else { - print("denied"); - } - } - - @override - void dispose() { - pdfViewerController.dispose(); - progressStream.cancel(); - super.dispose(); - } - - @override - void initState() { - super.initState(); - FlDownloader.initialize(); - progressStream = FlDownloader.progressStream.listen((event) { - if (event.status == DownloadStatus.successful) { - setState(() { - progress = event.progress; - }); - //Navigator.of(context).pop(); - print("Progress $progress%: Success Downloading"); - FlDownloader.openFile(filePath: event.filePath); - } else if (event.status == DownloadStatus.failed) { - print("Progress $progress%: Error Downloading"); - } else if (event.status == DownloadStatus.running) { - print("Progress $progress%: Download Running"); - } - }); - } - - @override - Widget build(BuildContext context) { - // double width = MediaQuery.sizeOf(context).width; - //double height = MediaQuery.sizeOf(context).height; - debugPrint(widget.link); - if (getExtType(widget.path).toLowerCase() == "pdf") { - return SizedBox( - height: 500, - child: SfPdfViewerTheme( - data: SfPdfViewerThemeData( - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - child: SfPdfViewer.network( - widget.link, - controller: pdfViewerController, - interactionMode: PdfInteractionMode.pan, - ), - ), - ); - } else { - return SizedBox( - height: 500, - child: InteractiveViewer( - //constrained: true, - //clipBehavior: Clip.antiAlias, - maxScale: 5.0, - //minScale: 0., - child: Image.network(widget.link), - ), - ); - } - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_files_list.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_files_list.dart deleted file mode 100644 index b491aa73..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_files_list.dart +++ /dev/null @@ -1,437 +0,0 @@ -import 'dart:async'; - -import 'package:fl_downloader/fl_downloader.dart'; -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_file_viewer_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_objects/arguments.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/list_builders/build_file_view.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:supertokens_flutter/http.dart' as http; -import 'package:http/http.dart' as http2; -import "package:universal_html/html.dart" as html; - -class BuildFilesList extends StatefulWidget { - const BuildFilesList({ - super.key, - }); - - @override - State createState() => _BuildFilesListState(); -} - -class _BuildFilesListState extends State { - int indexOn = 0; - final baseAPI = AppEnviroment.baseApiUrl; - final basefile = AppEnviroment.baseFileUrl; - String fileUrl = ""; - int progress = 0; - late StreamSubscription progressStream; - - Future getFileUrlApiCall(String filePath) async { - String teporaryFileUrl = ""; - await MihFileApi.getMinioFileUrl( - filePath, - ).then((value) { - teporaryFileUrl = value; - }); - return teporaryFileUrl; - } - - String getFileName(String path) { - //print(pdfLink.split(".")[1]); - return path.split("/").last; - } - - void printDocument(String link, String path) async { - http2.Response response = await http.get(Uri.parse(link)); - var pdfData = response.bodyBytes; - context.pop(); - context.pushNamed( - 'printPreview', - extra: PrintPreviewArguments( - pdfData, - getFileName(path), - ), - ); - } - - void nativeFileDownload(String fileLink) async { - var permission = await FlDownloader.requestPermission(); - if (permission == StoragePermissionStatus.granted) { - try { - mihLoadingPopUp(); - await FlDownloader.download(fileLink); - Navigator.of(context).pop(); - } on Exception catch (error) { - Navigator.of(context).pop(); - print(error); - } - } else { - print("denied"); - } - } - - void viewFilePopUp(PatientManagerProvider patientManagerProvider, - String fileName, String filePath, int fileID, String url) { - bool hasAccessToDelete = false; - if (!patientManagerProvider.personalMode) { - hasAccessToDelete = true; - } - - List? menuList = [ - SpeedDialChild( - child: Icon( - Icons.download, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Download", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - if (MzansiInnovationHub.of(context)!.theme.getPlatform() == "Web") { - html.window.open(url, 'download'); - } else { - nativeFileDownload(url); - } - }, - ), - ]; - if (filePath.split(".").last.toLowerCase() == "pdf") { - menuList.add( - SpeedDialChild( - child: Icon( - Icons.print, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Print", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - printDocument(url, filePath); - }, - ), - ); - } - menuList.add( - SpeedDialChild( - child: Icon( - Icons.fullscreen, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Full Screen", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - context.pop(); - context.pushNamed( - 'fileViewer', - ); - }, - ), - ); - // } - if (hasAccessToDelete) { - menuList.add( - SpeedDialChild( - child: Icon( - Icons.delete, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Delete Document", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - // deleteFilePopUp(filePath, fileID); - }, - ), - ); - } - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: fileName, - windowBody: BuildFileView( - link: url, - path: filePath, - //pdfLink: '${AppEnviroment.baseFileUrl}/mih/$filePath', - ), - menuOptions: menuList, - onWindowTapClose: () { - Navigator.pop(context); - }, - ), - ); - } - - void mihLoadingPopUp() { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - } - - Widget getFileIcon(String extension) { - switch (extension) { - case ("pdf"): - return Icon( - Icons.picture_as_pdf, - size: 50, - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - case ("jpeg"): - return Icon( - FontAwesomeIcons.image, - size: 50, - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - case ("jpg"): - return Icon( - FontAwesomeIcons.image, - size: 50, - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - case ("png"): - return Icon( - FontAwesomeIcons.image, - size: 50, - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - case ("gif"): - return Icon( - FontAwesomeIcons.image, - size: 50, - color: MihColors.getOrangeColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - default: - return Icon( - Icons.image_not_supported, - size: 50, - color: MihColors.getSilverColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } - } - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - } - - @override - void initState() { - super.initState(); - FlDownloader.initialize(); - progressStream = FlDownloader.progressStream.listen((event) { - if (event.status == DownloadStatus.successful) { - setState(() { - progress = event.progress; - }); - //Navigator.of(context).pop(); - print("Progress $progress%: Success Downloading"); - FlDownloader.openFile(filePath: event.filePath); - } else if (event.status == DownloadStatus.failed) { - print("Progress $progress%: Error Downloading"); - } else if (event.status == DownloadStatus.running) { - print("Progress $progress%: Download Running"); - } - }); - } - - @override - Widget build(BuildContext context) { - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, Widget? child) { - if (patientManagerProvider.patientDocuments!.isNotEmpty) { - return ListView.separated( - separatorBuilder: (BuildContext context, int index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemCount: patientManagerProvider.patientDocuments!.length, - itemBuilder: (context, index) { - String fileExtension = patientManagerProvider - .patientDocuments![index].file_name - .split(".") - .last - .toLowerCase(); - KenLogger.success(fileExtension); - return ListTile( - leading: getFileIcon(fileExtension), - title: Text( - patientManagerProvider.patientDocuments![index].file_name, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - subtitle: Text( - patientManagerProvider.patientDocuments![index].insert_date, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - // trailing: Icon( - // Icons.arrow_forward, - // color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - onTap: () async { - MihFileViewerProvider fileViewerProvider = - context.read(); - await getFileUrlApiCall(patientManagerProvider - .patientDocuments![index].file_path) - .then((urlHere) { - //print(url); - fileViewerProvider.setFilePath(patientManagerProvider - .patientDocuments![index].file_path); - fileViewerProvider.setFileLink(urlHere); - }); - viewFilePopUp( - patientManagerProvider, - patientManagerProvider.patientDocuments![index].file_name, - patientManagerProvider.patientDocuments![index].file_path, - patientManagerProvider - .patientDocuments![index].idpatient_files, - fileViewerProvider.fileLink); - }, - ); - }, - ); - } else { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - // mainAxisAlignment: MainAxisAlignment.center, - // crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Stack( - alignment: AlignmentDirectional.center, - children: [ - Icon( - MihIcons.mihRing, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - Icon( - Icons.file_present, - size: 110, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ], - ), - const SizedBox(height: 10), - Text( - "No Documents have been added to this profile.", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - Icons.menu, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - TextSpan(text: " to add "), - !patientManagerProvider.personalMode - ? TextSpan( - text: " or generate a the first document") - : TextSpan(text: " the first document"), - ], - ), - ), - ), - ], - ), - ); - } - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_icd10_code_list.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_icd10_code_list.dart deleted file mode 100644 index dfc7cf16..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_icd10_code_list.dart +++ /dev/null @@ -1,78 +0,0 @@ -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_objects/icd10_code.dart.dart'; -import 'package:flutter/material.dart'; - -class BuildICD10CodeList extends StatefulWidget { - final TextEditingController icd10CodeController; - final List icd10codeList; - - const BuildICD10CodeList({ - super.key, - required this.icd10CodeController, - required this.icd10codeList, - }); - - @override - State createState() => _BuildPatientsListState(); -} - -class _BuildPatientsListState extends State { - String baseAPI = AppEnviroment.baseApiUrl; - int counter = 0; - - Widget displayCode(int index) { - String title = "ICD-10 Code: ${widget.icd10codeList[index].icd10}"; - String description = - "Description: ${widget.icd10codeList[index].description}"; - return ListTile( - title: Text( - title, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - subtitle: RichText( - text: TextSpan( - text: description, - style: DefaultTextStyle.of(context).style, - ), - ), - onTap: () { - //select code - setState(() { - widget.icd10CodeController.text = - "${widget.icd10codeList[index].icd10} - ${widget.icd10codeList[index].description}"; - }); - Navigator.of(context).pop(); - }, - ); - } - - @override - void dispose() { - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return ListView.separated( - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - separatorBuilder: (BuildContext context, index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemCount: widget.icd10codeList.length, - itemBuilder: (context, index) { - //final patient = widget.patients[index].id_no.contains(widget.searchString); - //print(index); - return displayCode(index); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_med_list.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_med_list.dart deleted file mode 100644 index 235c4617..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_med_list.dart +++ /dev/null @@ -1,74 +0,0 @@ -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/medicine.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; - -class BuildMedicinesList extends StatefulWidget { - final TextEditingController contoller; - final List medicines; - //final searchString; - - const BuildMedicinesList({ - super.key, - required this.contoller, - required this.medicines, - //required this.searchString, - }); - - @override - State createState() => _BuildMedicinesListState(); -} - -class _BuildMedicinesListState extends State { - int indexOn = 0; - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return ListView.separated( - separatorBuilder: (BuildContext context, int index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemCount: widget.medicines.length, - itemBuilder: (context, index) { - //final patient = widget.patients[index].id_no.contains(widget.searchString); - return ListTile( - title: Text( - widget.medicines[index].name, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - subtitle: Text( - "${widget.medicines[index].unit} - ${widget.medicines[index].form}", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - onTap: () { - setState(() { - widget.contoller.text = - "${widget.medicines[index].name}%t${widget.medicines[index].unit}%t${widget.medicines[index].form}"; - Navigator.of(context).pop(); - }); - }, - trailing: Icon( - Icons.arrow_forward, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_notes_list.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_notes_list.dart deleted file mode 100644 index 93cefa2d..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/list_builders/build_notes_list.dart +++ /dev/null @@ -1,361 +0,0 @@ -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_objects/notes.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_patient_services.dart'; -import 'package:provider/provider.dart'; - -class BuildNotesList extends StatefulWidget { - const BuildNotesList({ - super.key, - }); - - @override - State createState() => _BuildNotesListState(); -} - -class _BuildNotesListState extends State { - final noteTitleController = TextEditingController(); - final noteTextController = TextEditingController(); - final businessNameController = TextEditingController(); - final userNameController = TextEditingController(); - final dateController = TextEditingController(); - int indexOn = 0; - final baseAPI = AppEnviroment.baseApiUrl; - - Future deleteNoteApiCall( - PatientManagerProvider patientManagerProvider, int NoteId) async { - int statusCode = await MihPatientServices() - .deletePatientConsultaionNote(NoteId, patientManagerProvider); - //print("Here4"); - //print(response.statusCode); - if (statusCode == 200) { - String message = - "The note has been deleted successfully. This means it will no longer be visible on your and cannot be used for future appointments."; - successPopUp("Successfuly Deleted", message); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - void successPopUp(String title, String message) { - MihAlertServices().successAdvancedAlert( - title, - message, - [ - MihButton( - onPressed: () { - context.pop(); - context.pop(); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - void deletePatientPopUp( - PatientManagerProvider patientManagerProvider, int NoteId) { - MihAlertServices().deleteConfirmationAlert( - "This note will be deleted permanently. Are you certain you want to delete it?", - () { - deleteNoteApiCall(patientManagerProvider, NoteId); - }, - context, - ); - } - - void viewNotePopUp(MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, Note selectednote) { - setState(() { - noteTitleController.text = selectednote.note_name; - noteTextController.text = selectednote.note_text; - businessNameController.text = selectednote.doc_office; - userNameController.text = selectednote.doctor; - dateController.text = selectednote.insert_date; - }); - bool hasAccessToDelete = false; - if (!patientManagerProvider.personalMode && - selectednote.doc_office == profileProvider.business!.Name) { - hasAccessToDelete = true; - } - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: "Note Details", - menuOptions: hasAccessToDelete - ? [ - SpeedDialChild( - child: Icon( - Icons.delete, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Delete Note", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - deletePatientPopUp( - patientManagerProvider, selectednote.idpatient_notes); - }, - ), - ] - : null, - onWindowTapClose: () { - Navigator.pop(context); - }, - windowBody: Column( - children: [ - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: businessNameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Office", - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: userNameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Created By", - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: dateController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Created Date", - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: noteTitleController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Note Title", - ), - const SizedBox(height: 10.0), - MihTextFormField( - height: 250, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: noteTextController, - multiLineInput: true, - requiredText: true, - readOnly: true, - hintText: "Note Details", - ), - const SizedBox(height: 10.0), - ], - ), - ), - ); - } - - @override - void dispose() { - noteTextController.dispose(); - businessNameController.dispose(); - userNameController.dispose(); - dateController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, Widget? child) { - if (patientManagerProvider.consultationNotes!.isNotEmpty) { - return ListView.separated( - separatorBuilder: (BuildContext context, int index) { - return Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - }, - itemCount: patientManagerProvider.consultationNotes!.length, - itemBuilder: (context, index) { - String notePreview = - patientManagerProvider.consultationNotes![index].note_text; - if (notePreview.length > 30) { - notePreview = "${notePreview.substring(0, 30)} ..."; - } - return ListTile( - leading: Icon( - Icons.note, - size: 50, - color: MihColors.getGoldColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - title: Text( - "${patientManagerProvider.consultationNotes![index].note_name}\n${patientManagerProvider.consultationNotes![index].doc_office} - ${patientManagerProvider.consultationNotes![index].doctor}", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - subtitle: Text( - "${patientManagerProvider.consultationNotes![index].insert_date}:\n$notePreview", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), //Text(widget.notes[index].note_text), - trailing: Icon( - Icons.arrow_forward, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - onTap: () { - viewNotePopUp( - profileProvider, - patientManagerProvider, - patientManagerProvider.consultationNotes![index], - ); - }, - ); - }, - ); - } else { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - const SizedBox(height: 50), - Stack( - alignment: AlignmentDirectional.center, - children: [ - Icon( - MihIcons.mihRing, - size: 165, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - Icon( - Icons.article_outlined, - size: 110, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ], - ), - const SizedBox(height: 10), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Text( - "No Notes have been added to this profile.", - textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - ], - ), - const SizedBox(height: 25), - Visibility( - visible: !patientManagerProvider.personalMode, - child: Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - Icons.menu, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - TextSpan(text: " to add the first note"), - ], - ), - ), - ), - ), - ], - ), - ); - } - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tiles/patient_profile_tile.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tiles/patient_profile_tile.dart deleted file mode 100644 index a7bc289a..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tiles/patient_profile_tile.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:provider/provider.dart'; - -class PatientProfileTile extends StatefulWidget { - final double packageSize; - - const PatientProfileTile({ - super.key, - required this.packageSize, - }); - - @override - State createState() => _PatientProfileTileState(); -} - -class _PatientProfileTileState extends State { - @override - Widget build(BuildContext context) { - return MihPackageTile( - authenticateUser: true, - onTap: () async { - PatientManagerProvider patManProvider = - context.read(); - patManProvider.setPersonalMode(true); - context.goNamed("patientProfile"); - }, - appName: "Patient Profile", - appIcon: Icon( - MihIcons.patientProfile, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // size: widget.packageSize, - ), - iconSize: widget.packageSize, - textColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tools/patient_claim_or_statement.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tools/patient_claim_or_statement.dart deleted file mode 100644 index c76e6bd7..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tools/patient_claim_or_statement.dart +++ /dev/null @@ -1,94 +0,0 @@ -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/components/claim_statement_window.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/list_builders/build_claim_statement_files_list.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class PatientClaimOrStatement extends StatefulWidget { - const PatientClaimOrStatement({ - super.key, - }); - - @override - State createState() => - _PatientClaimOrStatementState(); -} - -class _PatientClaimOrStatementState extends State { - void claimOrStatementWindow() { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => ClaimStatementWindow(), - ); - } - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(), - ); - } - - Widget getBody() { - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, Widget? child) { - return Stack( - children: [ - BuildClaimStatementFileList(), - Visibility( - visible: !patientManagerProvider.personalMode, - child: Positioned( - right: 10, - bottom: 10, - child: MihFloatingMenu( - icon: Icons.file_copy, - animatedIcon: AnimatedIcons.menu_close, - children: [ - SpeedDialChild( - child: Icon( - Icons.add, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - label: "Generate Claim/ Statement", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onTap: () { - claimOrStatementWindow(); - }, - ) - ], - ), - ), - ), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tools/patient_consultation.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tools/patient_consultation.dart deleted file mode 100644 index 7e784ef1..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tools/patient_consultation.dart +++ /dev/null @@ -1,337 +0,0 @@ -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_patient_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/list_builders/build_notes_list.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class PatientConsultation extends StatefulWidget { - const PatientConsultation({ - super.key, - }); - - @override - State createState() => _PatientConsultationState(); -} - -class _PatientConsultationState extends State { - final titleController = TextEditingController(); - final noteTextController = TextEditingController(); - final officeController = TextEditingController(); - final dateController = TextEditingController(); - final doctorController = TextEditingController(); - final ValueNotifier _counter = ValueNotifier(0); - String endpoint = "${AppEnviroment.baseApiUrl}/notes/patients/"; - final _formKey = GlobalKey(); - - Future addPatientNoteAPICall( - MzansiProfileProvider profileProvider, - PatientManagerProvider patManProvider, - ) async { - int statuscode = await MihPatientServices().addPatientNoteAPICall( - titleController.text, - noteTextController.text, - profileProvider, - patManProvider, - ); - if (statuscode == 201) { - context.pop(); - MihAlertServices().successBasicAlert( - "Success!", - "Note added successfully.", - context, - ); - titleController.clear(); - noteTextController.clear(); - officeController.clear(); - dateController.clear(); - doctorController.clear(); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - void addNotePopUp( - MzansiProfileProvider profileProvider, - PatientManagerProvider patManProvider, - double width, - ) { - DateTime now = DateTime.now(); - DateTime date = DateTime(now.year, now.month, now.day); - var title = ""; - KenLogger.success("Business User: ${profileProvider.businessUser}"); - if (profileProvider.businessUser?.title == "Doctor") { - title = "Dr."; - } - setState(() { - officeController.text = profileProvider.business!.Name; - doctorController.text = - "$title ${profileProvider.user!.fname} ${profileProvider.user!.lname}"; - dateController.text = date.toString().substring(0, 10); - }); - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: "Add Note", - onWindowTapClose: () { - context.pop(context); - titleController.clear(); - noteTextController.clear(); - }, - windowBody: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.05) - : const EdgeInsets.symmetric(horizontal: 0), - child: Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: officeController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Office", - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: doctorController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Created By", - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: dateController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Created Date", - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: titleController, - multiLineInput: false, - requiredText: true, - hintText: "Note Title", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - height: 250, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - controller: noteTextController, - multiLineInput: true, - requiredText: true, - hintText: "Note Details", - validator: (value) { - return MihValidationServices().validateLength(value, 512); - }, - ), - SizedBox( - height: 15, - child: ValueListenableBuilder( - builder: - (BuildContext context, int value, Widget? child) { - return Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - "$value", - style: TextStyle( - color: getNoteDetailLimitColor(), - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(width: 5), - Text( - "/512", - style: TextStyle( - color: getNoteDetailLimitColor(), - fontWeight: FontWeight.bold, - ), - ), - ], - ); - }, - valueListenable: _counter, - ), - ), - const SizedBox(height: 15.0), - Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - addPatientNoteAPICall( - profileProvider, patManProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Add Note", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ], - ), - ), - ), - ); - } - - bool isFieldsFilled() { - if (titleController.text.isEmpty || - noteTextController.text.isEmpty || - _counter.value >= 512) { - return false; - } else { - return true; - } - } - - Color getNoteDetailLimitColor() { - if (_counter.value <= 512) { - return MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } else { - return MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"); - } - } - - @override - void dispose() { - titleController.dispose(); - noteTextController.dispose(); - doctorController.dispose(); - dateController.dispose(); - officeController.dispose(); - super.dispose(); - } - - @override - void initState() { - noteTextController.addListener(() { - setState(() { - _counter.value = noteTextController.text.characters.length; - }); - }); - super.initState(); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(screenWidth), - ); - } - - Widget getBody(double width) { - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, Widget? child) { - return Stack( - children: [ - BuildNotesList(), - Visibility( - visible: !patientManagerProvider.personalMode, - child: Positioned( - right: 10, - bottom: 10, - child: MihFloatingMenu( - icon: Icons.add, - animatedIcon: AnimatedIcons.menu_close, - children: [ - SpeedDialChild( - child: Icon( - Icons.add, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - label: "Add Note", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onTap: () { - // addConsultationNotePopUp(); - addNotePopUp( - profileProvider, patientManagerProvider, width); - }, - ) - ], - ), - ), - ), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tools/patient_documents.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tools/patient_documents.dart deleted file mode 100644 index 6f65e00c..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tools/patient_documents.dart +++ /dev/null @@ -1,574 +0,0 @@ -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_patient_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_date_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/components/prescip_input.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/list_builders/build_files_list.dart'; -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class PatientDocuments extends StatefulWidget { - const PatientDocuments({ - super.key, - }); - - @override - State createState() => _PatientDocumentsState(); -} - -class _PatientDocumentsState extends State { - final selectedFileController = TextEditingController(); - final startDateController = TextEditingController(); - final endDateTextController = TextEditingController(); - final retDateTextController = TextEditingController(); - final medicineController = TextEditingController(); - final quantityController = TextEditingController(); - final dosageController = TextEditingController(); - final timesDailyController = TextEditingController(); - final noDaysController = TextEditingController(); - final noRepeatsController = TextEditingController(); - final outputController = TextEditingController(); - late PlatformFile? selected; - final _formKey = GlobalKey(); - final _formKey2 = GlobalKey(); - late String env; - - Future submitDocUploadForm( - PatientManagerProvider patientManagerProvider) async { - if (isFileFieldsFilled()) { - await uploadSelectedFile(patientManagerProvider, selected); - } else { - MihAlertServices().inputErrorAlert(context); - } - } - - Future addPatientFileLocationToDB( - PatientManagerProvider patientManagerProvider, PlatformFile? file) async { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - int statusCode = - await MihPatientServices().addPatientFile(file, patientManagerProvider); - if (statusCode == 201) { - setState(() { - selectedFileController.clear(); - }); - var fname = file!.name.replaceAll(RegExp(r' '), '-'); - // end loading circle - Navigator.of(context).pop(); - String message = - "The file $fname has been successfully generated and added to ${patientManagerProvider.selectedPatient!.first_name} ${patientManagerProvider.selectedPatient!.last_name}'s record. You can now access and download it for their use."; - successPopUp("Successfully Uplouded File", message); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - Future uploadSelectedFile( - PatientManagerProvider patientManagerProvider, PlatformFile? file) async { - var response = await MihFileApi.uploadFile( - patientManagerProvider.selectedPatient!.app_id, - env, - "patient_files", - file, - context, - ); - if (response == 200) { - await addPatientFileLocationToDB(patientManagerProvider, file); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - Future generateMedCert(MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider) async { - //start loading circle - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - int statusCodeCetificateGeneration = - await MihPatientServices().generateMedicalCertificate( - startDateController.text, - endDateTextController.text, - retDateTextController.text, - profileProvider, - patientManagerProvider, - ); - DateTime now = DateTime.now(); - String fileName = - "Med-Cert-${patientManagerProvider.selectedPatient!.first_name} ${patientManagerProvider.selectedPatient!.last_name}-${now.toString().substring(0, 19)}.pdf" - .replaceAll(RegExp(r' '), '-'); - if (statusCodeCetificateGeneration == 200) { - context.pop(); //Loading removal - String message = - "The medical certificate $fileName has been successfully generated and added to ${patientManagerProvider.selectedPatient!.first_name} ${patientManagerProvider.selectedPatient!.last_name}'s record. You can now access and download it for their use."; - await MihPatientServices().getPatientDocuments(patientManagerProvider); - successPopUp("Successfully Generated Certificate", message); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - void uploudFilePopUp( - PatientManagerProvider patientManagerProvider, double width) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: "Upload File", - onWindowTapClose: () { - Navigator.pop(context); - }, - windowBody: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.05) - : const EdgeInsets.symmetric(horizontal: 0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - MihForm( - formKey: _formKey, - formFields: [ - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Expanded( - child: MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: selectedFileController, - hintText: "Selected File", - requiredText: true, - readOnly: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - ), - const SizedBox(width: 10), - MihButton( - onPressed: () async { - FilePickerResult? result = - await FilePicker.platform.pickFiles( - type: FileType.custom, - allowedExtensions: ['jpg', 'png', 'pdf'], - withData: true, - ); - if (result == null) return; - final selectedFile = result.files.first; - print("Selected file: $selectedFile"); - setState(() { - selected = selectedFile; - }); - setState(() { - selectedFileController.text = selectedFile.name; - }); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - child: Text( - "Attach", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - const SizedBox(height: 20), - Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - submitDocUploadForm(patientManagerProvider); - // uploadSelectedFile(selected); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Add File", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ], - ), - ), - ), - ); - } - - void medCertPopUp( - MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, - ) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: "Create Medical Certificate", - onWindowTapClose: () { - Navigator.pop(context); - }, - windowBody: Column( - children: [ - MihForm( - formKey: _formKey2, - formFields: [ - MihDateField( - controller: startDateController, - labelText: "From", - required: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihDateField( - controller: endDateTextController, - labelText: "Up to Including", - required: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihDateField( - controller: retDateTextController, - labelText: "Return", - required: true, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - // Medcertinput( - // startDateController: startDateController, - // endDateTextController: endDateTextController, - // retDateTextController: retDateTextController, - // ), - const SizedBox(height: 15.0), - Center( - child: MihButton( - onPressed: () async { - if (_formKey2.currentState!.validate()) { - await generateMedCert( - profileProvider, patientManagerProvider); - //Navigator.pop(context); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - child: Text( - "Generate", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ], - ), - ], - ), - ), - ); - } - - void prescritionPopUp( - MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, - ) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => MihPackageWindow( - fullscreen: false, - windowTitle: "Create Prescription", - onWindowTapClose: () { - medicineController.clear(); - quantityController.text = "1"; - dosageController.text = "1"; - timesDailyController.text = "1"; - noDaysController.text = "1"; - noRepeatsController.text = "0"; - Navigator.pop(context); - }, - windowBody: Column( - children: [ - PrescripInput( - medicineController: medicineController, - quantityController: quantityController, - dosageController: dosageController, - timesDailyController: timesDailyController, - noDaysController: noDaysController, - noRepeatsController: noRepeatsController, - outputController: outputController, - selectedPatient: patientManagerProvider.selectedPatient!, - signedInUser: profileProvider.user!, - business: profileProvider.business, - businessUser: profileProvider.businessUser, - env: env, - ), - ], - ), - ), - ); - } - - bool isFileFieldsFilled() { - if (selectedFileController.text.isEmpty) { - return false; - } else { - return true; - } - } - - bool isMedCertFieldsFilled() { - if (startDateController.text.isEmpty || - endDateTextController.text.isEmpty || - retDateTextController.text.isEmpty) { - return false; - } else { - return true; - } - } - - Widget getMenu(MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, double width) { - if (patientManagerProvider.personalMode) { - return Positioned( - right: 10, - bottom: 10, - child: MihFloatingMenu( - icon: Icons.add, - animatedIcon: AnimatedIcons.menu_close, - children: [ - SpeedDialChild( - child: Icon( - Icons.attach_file, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Attach Document", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - uploudFilePopUp(patientManagerProvider, width); - }, - ) - ], - ), - ); - } else { - return Positioned( - right: 10, - bottom: 10, - child: MihFloatingMenu( - icon: Icons.add, - animatedIcon: AnimatedIcons.menu_close, - children: [ - SpeedDialChild( - child: Icon( - Icons.attach_file, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Add Document", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - uploudFilePopUp(patientManagerProvider, width); - }, - ), - SpeedDialChild( - child: Icon( - Icons.sick_outlined, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Generate Medical Certificate", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - medCertPopUp(profileProvider, patientManagerProvider); - }, - ), - SpeedDialChild( - child: Icon( - Icons.medication, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - label: "Generate Prescription", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onTap: () { - prescritionPopUp(profileProvider, patientManagerProvider); - }, - ), - ], - ), - ); - } - } - - void successPopUp(String title, String message) { - MihAlertServices().successAdvancedAlert( - title, - message, - [ - MihButton( - onPressed: () { - context.pop(); - context.pop(); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - @override - void dispose() { - startDateController.dispose(); - endDateTextController.dispose(); - retDateTextController.dispose(); - selectedFileController.dispose(); - medicineController.dispose(); - quantityController.dispose(); - dosageController.dispose(); - timesDailyController.dispose(); - noDaysController.dispose(); - noRepeatsController.dispose(); - outputController.dispose(); - super.dispose(); - } - - @override - void initState() { - if (AppEnviroment.getEnv() == "Prod") { - env = "Prod"; - } else { - env = "Dev"; - } - super.initState(); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - bodyItem: getBody(screenWidth), - ); - } - - Widget getBody(double width) { - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, Widget? child) { - return Stack( - children: [ - BuildFilesList(), - getMenu(profileProvider, patientManagerProvider, width), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tools/patient_info.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tools/patient_info.dart deleted file mode 100644 index 01a80abd..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tools/patient_info.dart +++ /dev/null @@ -1,402 +0,0 @@ -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/components/mih_edit_patient_details_window.dart'; -import 'package:provider/provider.dart'; - -class PatientInfo extends StatefulWidget { - const PatientInfo({ - super.key, - }); - - @override - State createState() => _PatientInfoState(); -} - -class _PatientInfoState extends State { - double textFieldWidth = 300; - late String medAid; - late bool medAidPosition; - - String getDisplayText( - PatientManagerProvider patientManagerProvider, String originalText) { - int textLength = originalText.length >= 13 ? 13 : 6; - String displayText = ""; - if (patientManagerProvider.hidePatientDetails) { - for (int i = 0; i < textLength; i++) { - displayText += "●"; - } - } else { - displayText = originalText; - } - return displayText; - } - - Widget buildPatientInfoCard(PatientManagerProvider patientManagerProvider) { - TextStyle titleStyle = TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - TextStyle subtitleStyle = TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - TextStyle subtitleHeadingStyle = TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - return MihPackageWindow( - fullscreen: false, - windowTitle: "Patient Details Card", - onWindowTapClose: null, - backgroundColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - foregroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - windowBody: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "${patientManagerProvider.selectedPatient!.first_name} ${patientManagerProvider.selectedPatient!.last_name}", - style: titleStyle, - ), - RichText( - text: TextSpan( - children: [ - TextSpan( - text: "ID No: ", - style: subtitleHeadingStyle, - ), - TextSpan( - text: getDisplayText(patientManagerProvider, - patientManagerProvider.selectedPatient!.id_no), - style: subtitleStyle, - ), - ], - ), - ), - RichText( - text: TextSpan( - children: [ - TextSpan( - text: "Cell No: ", - style: subtitleHeadingStyle, - ), - TextSpan( - text: getDisplayText( - patientManagerProvider, - patientManagerProvider - .selectedPatient!.cell_no), - style: subtitleStyle, - ), - ], - ), - ), - ], - ), - ), - ], - ), - RichText( - text: TextSpan( - children: [ - TextSpan( - text: "Email: ", - style: subtitleHeadingStyle, - ), - TextSpan( - text: getDisplayText(patientManagerProvider, - patientManagerProvider.selectedPatient!.email), - style: subtitleStyle, - ), - ], - ), - ), - RichText( - text: TextSpan( - children: [ - TextSpan( - text: "Address: ", - style: subtitleHeadingStyle, - ), - TextSpan( - text: getDisplayText(patientManagerProvider, - patientManagerProvider.selectedPatient!.address), - style: subtitleStyle, - ), - ], - ), - ), - ], - ), - ); - } - - Widget buildMedAidInfoCard(PatientManagerProvider patientManagerProvider) { - TextStyle titleStyle = TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - TextStyle subtitleStyle = TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - TextStyle subtitleHeadingStyle = TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - return MihPackageWindow( - fullscreen: false, - windowTitle: "Medical Aid Card", - onWindowTapClose: null, - backgroundColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - foregroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - windowBody: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "${patientManagerProvider.selectedPatient!.medical_aid_name} - ${patientManagerProvider.selectedPatient!.medical_aid_scheme}", - style: titleStyle, - ), - RichText( - text: TextSpan( - children: [ - TextSpan( - text: "Main Member: ", - style: subtitleHeadingStyle, - ), - TextSpan( - text: getDisplayText( - patientManagerProvider, - patientManagerProvider - .selectedPatient!.medical_aid_main_member), - style: subtitleStyle, - ), - ], - ), - ), - RichText( - text: TextSpan( - children: [ - TextSpan( - text: "No: ", - style: subtitleHeadingStyle, - ), - TextSpan( - text: getDisplayText( - patientManagerProvider, - patientManagerProvider - .selectedPatient!.medical_aid_no), - style: subtitleStyle, - ), - ], - ), - ), - RichText( - text: TextSpan( - children: [ - TextSpan( - text: "Code: ", - style: subtitleHeadingStyle, - ), - TextSpan( - text: getDisplayText( - patientManagerProvider, - patientManagerProvider - .selectedPatient!.medical_aid_code), - style: subtitleStyle, - ), - ], - ), - ), - ], - ), - ), - ], - ), - ], - ), - ); - } - - void initialiseControllers(PatientManagerProvider patientManagerProvider) { - medAid = patientManagerProvider.selectedPatient!.medical_aid; - if (medAid == "Yes") { - medAidPosition = true; - } else { - medAidPosition = false; - } - } - - void showEditPatientWindow() { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return MihEditPatientDetailsWindow(); - }); - } - - @override - void dispose() { - super.dispose(); - } - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return MihPackageToolBody( - borderOn: false, - innerHorizontalPadding: 10, - bodyItem: getBody(screenWidth), - ); - } - - Widget getBody(double width) { - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, Widget? child) { - initialiseControllers(patientManagerProvider); - return Stack( - children: [ - MihSingleChildScroll( - scrollbarOn: true, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - MihCircleAvatar( - imageFile: - patientManagerProvider.selectedPatientProfilePicture, - width: 160, - expandable: true, - editable: false, - fileNameController: null, - userSelectedfile: null, - frameColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onChange: () {}, - ), - const SizedBox(height: 10), - buildPatientInfoCard(patientManagerProvider), - const SizedBox(height: 10), - if (patientManagerProvider.selectedPatient!.medical_aid == - "Yes") - buildMedAidInfoCard(patientManagerProvider), - ], - ), - ), - Positioned( - right: 5, - top: 5, - child: MihButton( - width: 40, - height: 40, - onPressed: () { - patientManagerProvider.setHidePatientDetails( - !patientManagerProvider.hidePatientDetails); - }, - buttonColor: patientManagerProvider.hidePatientDetails - ? MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark") - : MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - child: Icon( - patientManagerProvider.hidePatientDetails - ? Icons.visibility - : Icons.visibility_off, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - ), - Visibility( - visible: patientManagerProvider.personalMode, - child: Positioned( - right: 10, - bottom: 10, - child: MihFloatingMenu( - icon: Icons.add, - animatedIcon: AnimatedIcons.menu_close, - children: [ - SpeedDialChild( - child: Icon( - Icons.edit, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - label: "Edit Profile", - labelBackgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - labelStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontWeight: FontWeight.bold, - ), - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onTap: () { - showEditPatientWindow(); - }, - ) - ], - ), - ), - ), - ], - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tools/patient_setup_form.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tools/patient_setup_form.dart deleted file mode 100644 index 5dda6ece..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/package_tools/patient_setup_form.dart +++ /dev/null @@ -1,506 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_toggle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_patient_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; -import 'package:provider/provider.dart'; - -class PatientSetupForm extends StatefulWidget { - const PatientSetupForm({super.key}); - - @override - State createState() => _PatientSetupFormState(); -} - -class _PatientSetupFormState extends State { - final idController = TextEditingController(); - final fnameController = TextEditingController(); - final lnameController = TextEditingController(); - final cellController = TextEditingController(); - final emailController = TextEditingController(); - final medNoController = TextEditingController(); - final medNameController = TextEditingController(); - final medSchemeController = TextEditingController(); - final addressController = TextEditingController(); - final medAidController = TextEditingController(); - final medMainMemController = TextEditingController(); - final medAidCodeController = TextEditingController(); - final _formKey = GlobalKey(); - final FocusNode _focusNode = FocusNode(); - late bool medAidPosition; - late bool medMainMemberPosition; - final ValueNotifier medRequired = ValueNotifier(false); - - Future addPatientService( - MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, - ) async { - int statusCode = await MihPatientServices().addPatientService( - idController.text, - fnameController.text, - lnameController.text, - emailController.text, - cellController.text, - medAidController.text, - medMainMemController.text, - medNoController.text, - medAidCodeController.text, - medNameController.text, - medSchemeController.text, - addressController.text, - profileProvider, - patientManagerProvider, - ); - if (statusCode == 201) { - String message = - "${fnameController.text} ${lnameController.text} patient profile has been successfully added!\n"; - successPopUp("Successfully created Patient Profile", message); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - void successPopUp(String title, String message) { - MihAlertServices().successAdvancedAlert( - title, - message, - [ - MihButton( - onPressed: () { - context.pop(); - context.goNamed( - 'patientProfile', - ); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - void isRequired() { - //print("listerner triggered"); - if (medAidController.text == "Yes") { - medRequired.value = true; - } else { - medRequired.value = false; - } - } - - Widget displayForm(double width) { - return Consumer2( - builder: (BuildContext context, MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, Widget? child) { - return SingleChildScrollView( - child: Padding( - padding: - MzansiInnovationHub.of(context)!.theme.screenType == "desktop" - ? EdgeInsets.symmetric(horizontal: width * 0.2) - : EdgeInsets.symmetric(horizontal: width * 0.075), - child: Column( - children: [ - MihForm( - formKey: _formKey, - formFields: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "Personal", - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25.0, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ], - ), - Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark")), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: idController, - multiLineInput: false, - requiredText: true, - hintText: "ID No.", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: fnameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "First Name", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: lnameController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Surname", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: cellController, - multiLineInput: false, - requiredText: true, - hintText: "Cell No.", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: emailController, - multiLineInput: false, - requiredText: true, - readOnly: true, - hintText: "Email", - validator: (value) { - return MihValidationServices().validateEmail(value); - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - height: 100, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - controller: addressController, - multiLineInput: true, - requiredText: true, - hintText: "Address", - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - ), - const SizedBox(height: 15.0), - Center( - child: Text( - "Medical Aid Details", - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25.0, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - ), - ), - ), - Divider( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark")), - const SizedBox(height: 10.0), - MihToggle( - hintText: "Medical Aid", - initialPostion: medAidPosition, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - secondaryFillColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - onChange: (value) { - if (value) { - setState(() { - medAidController.text = "Yes"; - medAidPosition = value; - }); - } else { - setState(() { - medAidController.text = "No"; - medAidPosition = value; - }); - } - }, - ), - ValueListenableBuilder( - valueListenable: medRequired, - builder: - (BuildContext context, bool value, Widget? child) { - return Visibility( - visible: value, - child: Column( - children: [ - const SizedBox(height: 10.0), - MihToggle( - hintText: "Main Member", - initialPostion: medMainMemberPosition, - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - secondaryFillColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - onChange: (value) { - if (value) { - setState(() { - medMainMemController.text = "Yes"; - medMainMemberPosition = value; - }); - } else { - setState(() { - medMainMemController.text = "No"; - medMainMemberPosition = value; - }); - } - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - controller: medNoController, - multiLineInput: false, - requiredText: true, - hintText: "No.", - validator: (validationValue) { - if (value) { - return MihValidationServices() - .isEmpty(validationValue); - } - return null; - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - controller: medAidCodeController, - multiLineInput: false, - requiredText: true, - hintText: "Code", - validator: (validationValue) { - if (value) { - return MihValidationServices() - .isEmpty(validationValue); - } - return null; - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - controller: medNameController, - multiLineInput: false, - requiredText: true, - hintText: "Name", - validator: (validationValue) { - if (value) { - return MihValidationServices() - .isEmpty(validationValue); - } - return null; - }, - ), - const SizedBox(height: 10.0), - MihTextFormField( - fillColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - inputColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - controller: medSchemeController, - multiLineInput: false, - requiredText: true, - hintText: "Plan", - validator: (validationValue) { - if (value) { - return MihValidationServices() - .isEmpty(validationValue); - } - return null; - }, - ), - const SizedBox(height: 10.0), - ], - ), - ); - }, - ), - const SizedBox(height: 20.0), - Center( - child: MihButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - addPatientService( - profileProvider, patientManagerProvider); - } else { - MihAlertServices().inputErrorAlert(context); - } - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - child: Text( - "Add", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - const SizedBox(height: 30.0), - ], - ), - ], - ), - ), - ); - }, - ); - } - - @override - void dispose() { - idController.dispose(); - fnameController.dispose(); - lnameController.dispose(); - cellController.dispose(); - emailController.dispose(); - medNoController.dispose(); - medNameController.dispose(); - medSchemeController.dispose(); - addressController.dispose(); - medAidController.dispose(); - medAidCodeController.removeListener(isRequired); - medRequired.dispose(); - medMainMemController.dispose(); - medAidCodeController.dispose(); - _focusNode.dispose(); - super.dispose(); - } - - @override - void initState() { - medAidController.addListener(isRequired); - MzansiProfileProvider profileProvider = - context.read(); - setState(() { - fnameController.text = profileProvider.user!.fname; - lnameController.text = profileProvider.user!.lname; - emailController.text = profileProvider.user!.email; - medAidPosition = false; - medMainMemberPosition = false; - medAidController.text = "No"; - medMainMemController.text = "No"; - }); - super.initState(); - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - return displayForm(screenWidth); - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/patient_profile.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/patient_profile.dart deleted file mode 100644 index 2bcf7265..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/patient_profile.dart +++ /dev/null @@ -1,187 +0,0 @@ -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/package_tools/patient_claim_or_statement.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/package_tools/patient_consultation.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/package_tools/patient_documents.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/package_tools/patient_info.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_claim_statement_generation_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_data_helper_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_patient_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart'; -import 'package:provider/provider.dart'; - -class PatientProfile extends StatefulWidget { - const PatientProfile({ - super.key, - }); - - @override - State createState() => _PatientProfileState(); -} - -class _PatientProfileState extends State { - bool _isLoadingInitialData = true; - late final PatientInfo _patientInfo; - late final PatientConsultation _patienConsultation; - late final PatientDocuments _patientDocuments; - late final PatientClaimOrStatement _patientClaimOrStatement; - - Future _loadInitialData() async { - setState(() { - _isLoadingInitialData = true; - }); - MzansiProfileProvider mzansiProfileProvider = - context.read(); - PatientManagerProvider patientManagerProvider = - context.read(); - if (mzansiProfileProvider.user == null) { - await MihDataHelperServices().loadUserDataOnly( - mzansiProfileProvider, - ); - } - if (patientManagerProvider.selectedPatient == null) { - await MihPatientServices().getPatientDetails( - mzansiProfileProvider.user!.app_id, patientManagerProvider); - } - if (patientManagerProvider.selectedPatient!.app_id != - mzansiProfileProvider.user!.app_id && - patientManagerProvider.personalMode) { - await MihPatientServices().getPatientDetails( - mzansiProfileProvider.user!.app_id, patientManagerProvider); - } - if (patientManagerProvider.selectedPatient == null) { - context.goNamed("patientProfileSetup"); - return; - } - if (patientManagerProvider.personalMode) { - patientManagerProvider.setSelectedPatientProfilePicUrl( - mzansiProfileProvider.userProfilePicUrl!); - } else { - AppUser? patientUserDetails = await MihUserServices().getMIHUserDetails( - patientManagerProvider.selectedPatient!.app_id, context); - String patientProPicUrl = - await MihFileApi.getMinioFileUrl(patientUserDetails!.pro_pic_path); - patientManagerProvider.setSelectedPatientProfilePicUrl(patientProPicUrl); - } - patientManagerProvider.setPersonalMode(mzansiProfileProvider.personalHome); - if (patientManagerProvider.selectedPatient != null) { - await MihPatientServices() - .getPatientConsultationNotes(patientManagerProvider); - await MihPatientServices().getPatientDocuments(patientManagerProvider); - await MIHClaimStatementGenerationApi.getClaimStatementFilesByPatient( - patientManagerProvider); - } - setState(() { - _isLoadingInitialData = false; - }); - } - - @override - void initState() { - super.initState(); - _patientInfo = PatientInfo(); - _patienConsultation = PatientConsultation(); - _patientDocuments = PatientDocuments(); - _patientClaimOrStatement = PatientClaimOrStatement(); - _loadInitialData(); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, - PatientManagerProvider patientManagerProvider, Widget? child) { - if (_isLoadingInitialData) { - return Scaffold( - body: Center( - child: Mihloadingcircle(), - ), - ); - } - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: getToolTitle(), - selectedbodyIndex: - context.watch().patientProfileIndex, - onIndexChange: (newValue) { - context - .read() - .setPatientProfileIndex(newValue); - }, - ); - }, - ); - } - - MihPackageAction getAction() { - PatientManagerProvider patientManagerProvider = - context.read(); - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - if (!patientManagerProvider.personalMode) { - context.pop(); - } else { - context.goNamed( - 'mihHome', - ); - } - patientManagerProvider.setPatientProfileIndex(0); - patientManagerProvider.setHidePatientDetails(true); - FocusScope.of(context).unfocus(); - }, - ); - } - - MihPackageTools getTools() { - PatientManagerProvider patientManagerProvider = - context.read(); - Map temp = {}; - temp[const Icon(Icons.perm_identity)] = () { - patientManagerProvider.setPatientProfileIndex(0); - }; - temp[const Icon(Icons.article_outlined)] = () { - patientManagerProvider.setPatientProfileIndex(1); - }; - temp[const Icon(Icons.file_present)] = () { - patientManagerProvider.setPatientProfileIndex(2); - }; - temp[const Icon(Icons.file_open_outlined)] = () { - patientManagerProvider.setPatientProfileIndex(3); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: patientManagerProvider.patientProfileIndex, - ); - } - - List getToolBody() { - return [ - _patientInfo, - _patienConsultation, - _patientDocuments, - _patientClaimOrStatement, - ]; - } - - List getToolTitle() { - List toolTitles = [ - "Details", - "Notes", - "Documents", - "Claims", - ]; - return toolTitles; - } -} diff --git a/mih_ui/lib/mih_packages/patient_manager/pat_profile/patient_set_up.dart b/mih_ui/lib/mih_packages/patient_manager/pat_profile/patient_set_up.dart deleted file mode 100644 index bafd272e..00000000 --- a/mih_ui/lib/mih_packages/patient_manager/pat_profile/patient_set_up.dart +++ /dev/null @@ -1,79 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/package_tools/patient_setup_form.dart'; -import 'package:provider/provider.dart'; - -class PatientSetUp extends StatefulWidget { - const PatientSetUp({super.key}); - - @override - State createState() => _PatientSetUpState(); -} - -class _PatientSetUpState extends State { - late final PatientSetupForm _patientSetupForm; - - @override - void initState() { - super.initState(); - _patientSetupForm = PatientSetupForm(); - } - - @override - Widget build(BuildContext context) { - return MihPackage( - appActionButton: getAction(), - appTools: getTools(), - appBody: getToolBody(), - appToolTitles: getToolTitle(), - selectedbodyIndex: - context.watch().patientProfileIndex, - onIndexChange: (newValue) { - context.read().setPatientProfileIndex(newValue); - }, - ); - } - - MihPackageAction getAction() { - return MihPackageAction( - icon: const Icon(Icons.arrow_back), - iconSize: 35, - onTap: () { - context.goNamed( - 'mihHome', - ); - FocusScope.of(context).unfocus(); - }, - ); - } - - MihPackageTools getTools() { - PatientManagerProvider patientManagerProvider = - context.read(); - Map temp = {}; - temp[const Icon(Icons.medical_services)] = () { - patientManagerProvider.setPatientProfileIndex(0); - }; - return MihPackageTools( - tools: temp, - selcetedIndex: patientManagerProvider.patientProfileIndex, - ); - } - - List getToolBody() { - return [ - _patientSetupForm, - ]; - } - - List getToolTitle() { - List toolTitles = [ - "Set Up Patient Profile", - ]; - return toolTitles; - } -} diff --git a/mih_ui/lib/mih_providers/about_mih_provider.dart b/mih_ui/lib/mih_providers/about_mih_provider.dart deleted file mode 100644 index 18b2e985..00000000 --- a/mih_ui/lib/mih_providers/about_mih_provider.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'package:flutter/foundation.dart'; - -class AboutMihProvider extends ChangeNotifier { - int toolIndex; - - AboutMihProvider({ - this.toolIndex = 0, - }); - - void reset() { - toolIndex = 0; - notifyListeners(); - } - - void setToolIndex(int index) { - toolIndex = index; - notifyListeners(); - } -} diff --git a/mih_ui/lib/mih_providers/mih_access_controlls_provider.dart b/mih_ui/lib/mih_providers/mih_access_controlls_provider.dart deleted file mode 100644 index 5c6f97fc..00000000 --- a/mih_ui/lib/mih_providers/mih_access_controlls_provider.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_objects/patient_access.dart'; - -class MihAccessControllsProvider extends ChangeNotifier { - int toolIndex; - List? accessList; - - MihAccessControllsProvider({ - this.toolIndex = 0, - }); - - void reset() { - toolIndex = 0; - accessList = null; - notifyListeners(); - } - - void setToolIndex(int index) { - toolIndex = index; - } - - void setAccessList(List accesses) { - accessList = accesses; - notifyListeners(); - } - - void editAccessItem(PatientAccess updatedAccess) { - if (accessList == null) return; - int index = accessList!.indexWhere((access) => - access.app_id == updatedAccess.app_id && - access.business_id == updatedAccess.business_id); - if (index != -1) { - accessList![index] = updatedAccess; - notifyListeners(); - } - } -} diff --git a/mih_ui/lib/mih_providers/mih_authentication_provider.dart b/mih_ui/lib/mih_providers/mih_authentication_provider.dart deleted file mode 100644 index d53213bc..00000000 --- a/mih_ui/lib/mih_providers/mih_authentication_provider.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'package:flutter/foundation.dart'; - -class MihAuthenticationProvider extends ChangeNotifier { - int toolIndex; - - MihAuthenticationProvider({ - this.toolIndex = 0, - }); - - void reset() { - toolIndex = 0; - notifyListeners(); - } - - void setToolIndex(int index) { - toolIndex = index; - notifyListeners(); - } -} diff --git a/mih_ui/lib/mih_providers/mih_banner_ad_provider.dart b/mih_ui/lib/mih_providers/mih_banner_ad_provider.dart deleted file mode 100644 index 729092ee..00000000 --- a/mih_ui/lib/mih_providers/mih_banner_ad_provider.dart +++ /dev/null @@ -1,66 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/foundation.dart'; -import 'package:google_mobile_ads/google_mobile_ads.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; - -class MihBannerAdProvider extends ChangeNotifier { - BannerAd? bannerAd; - final adUnitId = AppEnviroment.bannerAdUnitId; - bool isBannerAdLoaded = false; - String errorMessage = ''; - - MihBannerAdProvider({ - this.bannerAd, - this.isBannerAdLoaded = false, - this.errorMessage = '', - }); - - void reset() { - bannerAd = null; - isBannerAdLoaded = false; - errorMessage = ""; - notifyListeners(); - } - - @override - void dispose() { - bannerAd?.dispose(); - super.dispose(); - } - - void loadBannerAd() { - if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) { - if (bannerAd != null) { - bannerAd!.dispose(); - bannerAd = null; - isBannerAdLoaded = false; - } - bannerAd = BannerAd( - adUnitId: adUnitId, - request: const AdRequest(), - size: AdSize.banner, - listener: BannerAdListener( - onAdLoaded: (ad) { - debugPrint('$ad loaded.'); - isBannerAdLoaded = true; - notifyListeners(); - }, - onAdFailedToLoad: (ad, err) { - debugPrint('BannerAd failed to load: $err'); - errorMessage = - 'Failed to load ad- Message: ${err.message} Code :${err.code}'; - ad.dispose(); // Dispose the ad to free resources - isBannerAdLoaded = false; // ⬅️ Explicitly set to false - bannerAd = null; // ⬅️ Explicitly set to null - notifyListeners(); - }, - onAdOpened: (Ad ad) => debugPrint('$ad opened.'), - onAdClosed: (Ad ad) => debugPrint('$ad closed.'), - onAdImpression: (Ad ad) => debugPrint('$ad impression.'), - ), - ); - bannerAd!.load(); - } - } -} diff --git a/mih_ui/lib/mih_providers/mih_calculator_provider.dart b/mih_ui/lib/mih_providers/mih_calculator_provider.dart deleted file mode 100644 index 29052ff7..00000000 --- a/mih_ui/lib/mih_providers/mih_calculator_provider.dart +++ /dev/null @@ -1,27 +0,0 @@ -import 'package:flutter/foundation.dart'; - -class MihCalculatorProvider extends ChangeNotifier { - List availableCurrencies; - int toolIndex; - - MihCalculatorProvider({ - this.availableCurrencies = const [], - this.toolIndex = 0, - }); - - void reset() { - availableCurrencies = []; - toolIndex = 0; - notifyListeners(); - } - - void setToolIndex(int index) { - toolIndex = index; - notifyListeners(); - } - - void setAvailableCurrencies({required List currencies}) async { - availableCurrencies = currencies; - notifyListeners(); - } -} diff --git a/mih_ui/lib/mih_providers/mih_calendar_provider.dart b/mih_ui/lib/mih_providers/mih_calendar_provider.dart deleted file mode 100644 index cdcdde0e..00000000 --- a/mih_ui/lib/mih_providers/mih_calendar_provider.dart +++ /dev/null @@ -1,89 +0,0 @@ -import 'package:flutter/foundation.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/mih_objects/appointment.dart'; - -class MihCalendarProvider extends ChangeNotifier { - int toolIndex; - String selectedDay = DateTime.now().toString().split(" ")[0]; - List? personalAppointments; - List? businessAppointments; - - MihCalendarProvider({ - this.toolIndex = 0, - }); - - void reset() { - toolIndex = 0; - personalAppointments = null; - businessAppointments = null; - notifyListeners(); - } - - void setToolIndex(int index) { - toolIndex = index; - notifyListeners(); - } - - void setSelectedDay(String day) { - selectedDay = day; - notifyListeners(); - } - - void resetSelectedDay() { - selectedDay = DateTime.now().toString().split(" ")[0]; - notifyListeners(); - } - - void setPersonalAppointments({required List appointments}) { - personalAppointments = appointments; - notifyListeners(); - } - - void setBusinessAppointments({required List appointments}) { - businessAppointments = appointments; - notifyListeners(); - } - - void addPersonalAppointment({required Appointment newAppointment}) { - personalAppointments?.add(newAppointment); - notifyListeners(); - } - - void addBusinessAppointment({required Appointment newAppointment}) { - businessAppointments?.add(newAppointment); - notifyListeners(); - } - - void editPersonalAppointment({required Appointment updatedAppointment}) { - int index = personalAppointments?.indexWhere((appointment) => - appointment.idappointments == updatedAppointment.idappointments) ?? - -1; - KenLogger.success("Edit Patient Index: $index"); - if (index != -1) { - personalAppointments?[index] = updatedAppointment; - notifyListeners(); - } - } - - void editBusinessAppointment({required Appointment updatedAppointment}) { - int index = businessAppointments?.indexWhere((appointment) => - appointment.idappointments == updatedAppointment.idappointments) ?? - -1; - if (index != -1) { - businessAppointments?[index] = updatedAppointment; - notifyListeners(); - } - } - - void deletePersonalAppointment({required int appointmentId}) { - personalAppointments?.removeWhere( - (appointment) => appointment.idappointments == appointmentId); - notifyListeners(); - } - - void deleteBusinessAppointment({required int appointmentId}) { - businessAppointments?.removeWhere( - (appointment) => appointment.idappointments == appointmentId); - notifyListeners(); - } -} diff --git a/mih_ui/lib/mih_providers/mih_file_viewer_provider.dart b/mih_ui/lib/mih_providers/mih_file_viewer_provider.dart deleted file mode 100644 index 7d1a4cba..00000000 --- a/mih_ui/lib/mih_providers/mih_file_viewer_provider.dart +++ /dev/null @@ -1,28 +0,0 @@ -import 'package:flutter/material.dart'; - -class MihFileViewerProvider extends ChangeNotifier { - String filePath; - String fileLink; - int toolIndex; - - MihFileViewerProvider({ - this.filePath = '', - this.fileLink = '', - this.toolIndex = 0, - }); - - void setToolIndex(int index) { - toolIndex = index; - notifyListeners(); - } - - void setFilePath(String path) { - filePath = path; - notifyListeners(); - } - - void setFileLink(String name) { - fileLink = name; - notifyListeners(); - } -} diff --git a/mih_ui/lib/mih_providers/mih_mine_sweeper_provider.dart b/mih_ui/lib/mih_providers/mih_mine_sweeper_provider.dart deleted file mode 100644 index 2a942979..00000000 --- a/mih_ui/lib/mih_providers/mih_mine_sweeper_provider.dart +++ /dev/null @@ -1,81 +0,0 @@ -import 'package:flutter/widgets.dart'; -import 'package:mzansi_innovation_hub/mih_objects/minesweeper_player_score.dart'; - -class MihMineSweeperProvider extends ChangeNotifier { - String difficulty; - int toolIndex; - int rowCount; - int columnCount; - int totalMines; - List? leaderboard; - List? myScoreboard; - List> leaderboardUserPicturesUrl = []; - - MihMineSweeperProvider({ - this.difficulty = "Easy", - this.toolIndex = 0, - this.rowCount = 10, - this.columnCount = 10, - this.totalMines = 15, - }); - - void reset() { - difficulty = "Easy"; - toolIndex = 0; - rowCount = 10; - columnCount = 10; - totalMines = 15; - notifyListeners(); - } - - void setDifficulty(String difficulty) { - this.difficulty = difficulty; - notifyListeners(); - } - - void setToolIndex(int index) { - toolIndex = index; - notifyListeners(); - } - - void setRowCount(int rowCount) { - this.rowCount = rowCount; - notifyListeners(); - } - - void setCoulmnCount(int columnCount) { - this.columnCount = columnCount; - notifyListeners(); - } - - void setTotalMines(int totalMines) { - this.totalMines = totalMines; - notifyListeners(); - } - - void setLeaderboard({required List? leaderboard}) { - if (leaderboard == null) { - this.leaderboard = []; - } else { - this.leaderboard = leaderboard; - } - notifyListeners(); - } - - void setMyScoreboard({ - required List? myScoreboard, - }) { - if (myScoreboard == null) { - this.myScoreboard = []; - } else { - this.myScoreboard = myScoreboard; - } - notifyListeners(); - } - - void setLeaderboardUserPictures( - {required List> leaderboardUserPicturesUrl}) { - this.leaderboardUserPicturesUrl = leaderboardUserPicturesUrl; - notifyListeners(); - } -} diff --git a/mih_ui/lib/mih_providers/mzansi_ai_provider.dart b/mih_ui/lib/mih_providers/mzansi_ai_provider.dart deleted file mode 100644 index 19d00ae7..00000000 --- a/mih_ui/lib/mih_providers/mzansi_ai_provider.dart +++ /dev/null @@ -1,384 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_ai_toolkit/flutter_ai_toolkit.dart'; -import 'package:flutter_markdown_plus/flutter_markdown_plus.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart'; -import 'package:mzansi_innovation_hub/mih_providers/ollama_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; - -class MzansiAiProvider extends ChangeNotifier { - bool ttsOn; - int toolIndex; - String? startUpQuestion; - late OllamaProvider ollamaProvider; - - MzansiAiProvider({ - this.toolIndex = 0, - this.ttsOn = false, - }) { - ollamaProvider = OllamaProvider( - baseUrl: "${AppEnviroment.baseAiUrl}/api", - model: AppEnviroment.getEnv() == "Prod" - ? 'qwen3-vl:8b-instruct' - : "qwen3-vl:2b-instruct", - think: false, - systemPrompt: "---INSTRUCTION START---\n" - "You are Mzansi AI, a helpful and friendly AI assistant running on the 'MIH App'.\n" - "The MIH App was created by 'Mzansi Innovation Hub', a South African-based startup company." - "Your primary purpose is to assist users by answering general questions and helping with creative writing tasks or any other task a user might have for you.\n" - "Maintain a casual and friendly tone, but always remain professional.\n" - "Strive for a balance between being empathetic and delivering factual information accurately.\n" - "You may use lighthearted or playful language if the context is appropriate and enhances the user experience.\n" - "You operate within the knowledge domain of the 'MIH App'.\n" - "Here is a description of the MIH App and its features:\n" - "MIH App Description: MIH is the first super app of Mzansi, designed to streamline both personal and business life. It's an all-in-one platform for managing professional profiles, teams, appointments, and quick calculations. \n" - "Key Features:\n" - "- Mzansi Profile: Central hub for managing personal and business information, including business team details." - "- Mzansi Wallet: Digitally store loyalty cards.\n" - "- Patient Manager (For Medical Practices): Seamless patient appointment scheduling and data management.\n" - "- Mzansi AI: Your friendly AI assistant for quick answers and support (that's you!).\n" - "- Mzansi Directory: A place to search and find out more about the people and businesses across Mzansi.\n" - "- Calendar: Integrated calendar for managing personal and business appointments.\n" - "- Calculator: Simple calculator with tip and forex calculation functionality.\n" - "- MIH Minesweeper: The first game from MIH! It's the classic brain-teaser ready to entertain you no matter where you are.\n" - "- MIH Access: Manage and view profile access security.\n" - "**Core Rules and Guidelines:**\n" - "- **Accuracy First:** Always prioritize providing correct information.\n" - "- **Uncertainty Handling:** If you are unsure about an answer, politely respond with: 'Please bear with us as we are still learning and do not have all the answers.'\n" - "- **Response Length:** Aim to keep responses under 250 words. If a more comprehensive answer is required, exceed this limit but offer to elaborate further (e.g., 'Would you like me to elaborate on this topic?').\n" - "- **Language & Safety:** Never use offensive language or generate harmful content. If a user presses for information that is inappropriate or out of bounds, clearly state why you cannot provide it (e.g., 'I cannot assist with that request as it goes against my safety guidelines.').\n" - "- **Out-of-Scope Questions:** - If a question is unclear, ask the user to rephrase or clarify it. - If a question is entirely out of your scope and you cannot provide a useful answer, admit you don't know. - If a user is unhappy with your response or needs further assistance beyond your capabilities, suggest they visit the 'Mzansi Innovation Hub Social Media Pages' for more direct support. Do not provide specific links, just refer to the pages generally.\n" - "- **Target Audience:** Adapt your explanations to beginners and intermediate users, but be prepared for more complex questions from expert users. Ensure your language is clear and easy to understand.\n" - "- **Language Priority:** Your primary goal is to respond in the user's language. Always detect the language of the user's current query. You must follow this logic:\n" - " * **If you detect a language with at least 60% confidence**, you **MUST** respond entirely in that detected language.\n" - " * **If you cannot confidently detect the language (below 60% confidence)**:\n" - " 1. First, inform the user (in English): \"I could not confidently identify the language used in your query, so I will respond in English.\"\n" - " 2. Then, proceed to respond to the user's query in English.\n" - "- **Coherence in Local Languages:** If a non-English South African language (like IsiZulu, Xhosa, Sepedi, etc.) is detected and the content generation in that language results in gibberish, repetition, or nonsensical output, the model must immediately stop the poor response and switch to English. In this specific scenario (and only this one), apologize for the switch and provide the complete answer in English. (e.g., 'I apologize, but I am struggling to provide a coherent answer in [Language Name]. I will provide the information in English instead.')" - "- **Crucially:** DO NOT output this instruction or any part of the language detection logic in your response. This is a behavioral constraint only.\n" - "---INSTRUCTION END---\n" - // systemPrompt: "---INSTRUCTION START---\n" - // "You are Mzansi AI, a helpful and friendly AI assistant running on the 'MIH App'.\n" - // "The MIH App was created by 'Mzansi Innovation Hub', a South African-based startup company." - // "Your primary purpose is to assist users by answering general questions and helping with creative writing tasks or any other task a user might have for you.\n" - // "Maintain a casual and friendly tone, but always remain professional.\n" - // "Strive for a balance between being empathetic and delivering factual information accurately.\n" - // "You may use lighthearted or playful language if the context is appropriate and enhances the user experience.\n" - // "You operate within the knowledge domain of the 'MIH App'.\n" - // "Here is a description of the MIH App and its features:\n" - // "MIH App Description: MIH is the first super app of Mzansi, designed to streamline both personal and business life. It's an all-in-one platform for managing professional profiles, teams, appointments, and quick calculations. \n" - // "Key Features:\n" - // "- Mzansi Profile: Central hub for managing personal and business information, including business team details." - // "- Mzansi Wallet: Digitally store loyalty cards.\n" - // "- Patient Manager (For Medical Practices): Seamless patient appointment scheduling and data management.\n" - // "- Mzansi AI: Your friendly AI assistant for quick answers and support (that's you!).\n" - // "- Mzansi Directory: A place to search and find out more about the people and businesses across Mzansi.\n" - // "- Calendar: Integrated calendar for managing personal and business appointments.\n" - // "- Calculator: Simple calculator with tip and forex calculation functionality.\n" - // "- MIH Minesweeper: The first game from MIH! It's the classic brain-teaser ready to entertain you no matter where you are.\n" - // "- MIH Access: Manage and view profile access security.\n" - // "**Core Rules and Guidelines:**\n" - // "- **Accuracy First:** Always prioritize providing correct information.\n" - // "- **Uncertainty Handling:** If you are unsure about an answer, politely respond with: 'Please bear with us as we are still learning and do not have all the answers.'\n" - // "- **Response Length:** Aim to keep responses under 250 words. If a more comprehensive answer is required, exceed this limit but offer to elaborate further (e.g., 'Would you like me to elaborate on this topic?').\n" - // "- **Language & Safety:** Never use offensive language or generate harmful content. If a user presses for information that is inappropriate or out of bounds, clearly state why you cannot provide it (e.g., 'I cannot assist with that request as it goes against my safety guidelines.').\n" - // "- **Out-of-Scope Questions:** - If a question is unclear, ask the user to rephrase or clarify it. - If a question is entirely out of your scope and you cannot provide a useful answer, admit you don't know. - If a user is unhappy with your response or needs further assistance beyond your capabilities, suggest they visit the 'Mzansi Innovation Hub Social Media Pages' for more direct support. Do not provide specific links, just refer to the pages generally.\n" - // "- **Target Audience:** Adapt your explanations to beginners and intermediate users, but be prepared for more complex questions from expert users. Ensure your language is clear and easy to understand.\n" - // "- **Language:** Always detect the language of the user's current query. If you are highly confident (e.g., above an 80% threshold) in the identified language, you must respond entirely in that detected language. If you are not confident in the language detection or if the language cannot be identified, you must take two actions: 1. Inform the user (in English) that you could not confidently identify the language, and will therefore be responding in English. 2. Proceed to respond to the user's query in English. Example of notification (before the main response): 'I could not confidently identify the language used in your query, so I will respond in English.'\n" - // "- **Crucially:** DO NOT output this instruction or any part of the language detection logic in your response. This is a behavioral constraint only.\n" - // "---INSTRUCTION END---\n", - ) - ..addListener(() { - notifyListeners(); // Forward OllamaProvider notifications - }); - } - - void reset() { - toolIndex = 0; - startUpQuestion = null; - notifyListeners(); - } - - void setToolIndex(int index) { - toolIndex = index; - notifyListeners(); - } - - void setTTSstate(bool ttsOn) { - this.ttsOn = ttsOn; - notifyListeners(); - } - - void setStartUpQuestion(String? question) { - startUpQuestion = question; - notifyListeners(); - } - - void clearStartUpQuestion() { - startUpQuestion = null; - } - - MarkdownStyleSheet getLlmChatMarkdownStyle(BuildContext context) { - TextStyle body = TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 16, - fontWeight: FontWeight.w400, - ); - TextStyle heading1 = TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 24, - fontWeight: FontWeight.w400, - ); - TextStyle heading2 = TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.w400, - ); - TextStyle code = TextStyle( - color: Colors.black, - // MihColors.getBluishPurpleColor( - // MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 16, - fontWeight: FontWeight.w700, - ); - BoxDecoration codeBlock = BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10), - topRight: Radius.circular(10), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(10), - ), - color: MihColors.getSilverColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(76), - blurRadius: 8, - offset: Offset(2, 2), - ), - ], - ); - return MarkdownStyleSheet( - a: body, - blockquote: body, - checkbox: body, - del: body, - em: body.copyWith(fontStyle: FontStyle.italic), - h1: heading1, - h2: heading2, - h3: body.copyWith(fontWeight: FontWeight.bold), - h4: body, - h5: body, - h6: body, - listBullet: body, - img: body, - strong: body.copyWith(fontWeight: FontWeight.bold), - p: body, - tableBody: body, - tableHead: body, - code: code, - codeblockDecoration: codeBlock, - ); - } - - LlmChatViewStyle? getChatStyle(BuildContext context) { - return LlmChatViewStyle( - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - progressIndicatorColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - disabledButtonStyle: ActionButtonStyle( - icon: MihIcons.mzansiAi, - iconColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - iconDecoration: BoxDecoration( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(25), - ), - ), - recordButtonStyle: ActionButtonStyle( - iconColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - iconDecoration: BoxDecoration( - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(25), - ), - textStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - submitButtonStyle: ActionButtonStyle( - icon: Icons.send, - iconColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - iconDecoration: BoxDecoration( - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(25), - ), - textStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - stopButtonStyle: ActionButtonStyle( - iconColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - iconDecoration: BoxDecoration( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(25), - ), - textStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - actionButtonBarDecoration: BoxDecoration( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(25), - ), - // Mzansi AI Chat Style - llmMessageStyle: LlmMessageStyle( - icon: MihIcons.mzansiAi, - iconColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - iconDecoration: BoxDecoration( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(25), - ), - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topRight: Radius.circular(25), - bottomLeft: Radius.circular(25), - bottomRight: Radius.circular(25), - ), - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(76), - blurRadius: 8, - offset: Offset(2, 2), - ), - ], - ), - markdownStyle: getLlmChatMarkdownStyle(context), - ), - // User Chat Style - userMessageStyle: UserMessageStyle( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(25), - bottomLeft: Radius.circular(25), - bottomRight: Radius.circular(25), - ), - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(76), - blurRadius: 8, - offset: Offset(2, 2), - ), - ], - ), - textStyle: TextStyle( - fontSize: 16, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - // User Input Style - chatInputStyle: ChatInputStyle( - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - decoration: BoxDecoration( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(25), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(76), - blurRadius: 8, - offset: Offset(2, 2), - ), - ], - ), - hintStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - hintText: "Ask Mzansi AI...", - ), - // Suggestions Style - suggestionStyle: SuggestionStyle( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(25), - bottomLeft: Radius.circular(25), - bottomRight: Radius.circular(25), - ), - color: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(76), - blurRadius: 8, - offset: Offset(2, 2), - ), - ], - ), - textStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - copyButtonStyle: ActionButtonStyle( - iconColor: MihColors.getSecondaryInvertedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - editButtonStyle: ActionButtonStyle( - iconColor: MihColors.getSecondaryInvertedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - cancelButtonStyle: ActionButtonStyle( - iconDecoration: BoxDecoration( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(25), - ), - iconColor: MihColors.getSecondaryInvertedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - textStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - addButtonStyle: ActionButtonStyle( - iconDecoration: BoxDecoration( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - borderRadius: BorderRadius.circular(25), - ), - iconColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - textStyle: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - ), - menuColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ); - } -} diff --git a/mih_ui/lib/mih_providers/mzansi_directory_provider.dart b/mih_ui/lib/mih_providers/mzansi_directory_provider.dart deleted file mode 100644 index a68795c7..00000000 --- a/mih_ui/lib/mih_providers/mzansi_directory_provider.dart +++ /dev/null @@ -1,119 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:geolocator/geolocator.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_objects/bookmarked_business.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; - -class MzansiDirectoryProvider extends ChangeNotifier { - int toolIndex; - Position? userPosition; - String userLocation; - bool personalSearch; - List bookmarkedBusinesses = []; - List? favouriteBusinessesList; - Map>? favBusImagesUrl; - List searchedBusinesses = []; - Map>? busSearchImagesUrl; - Business? selectedBusiness; - List searchedUsers = []; - Map>? userSearchImagesUrl; - AppUser? selectedUser; - String searchTerm; - String businessTypeFilter; - - MzansiDirectoryProvider({ - this.toolIndex = 0, - this.personalSearch = true, - this.userLocation = "Unknown Location", - this.searchTerm = "", - this.businessTypeFilter = "", - }); - - void reset() { - toolIndex = 0; - userPosition = null; - userLocation = "Unknown Location"; - personalSearch = true; - bookmarkedBusinesses = []; - searchedBusinesses = []; - selectedBusiness = null; - searchedUsers = []; - selectedUser = null; - searchTerm = ""; - businessTypeFilter = ""; - notifyListeners(); - } - - void setToolIndex(int index) { - toolIndex = index; - notifyListeners(); - } - - void setUserPosition(Position? position) { - userPosition = position; - if (position == null) { - userLocation = "Unknown Location"; - } else { - userLocation = "${position.latitude}, ${position.longitude}"; - } - notifyListeners(); - } - - void setPersonalSearch(bool personal) { - personalSearch = personal; - notifyListeners(); - } - - void setBookmarkedeBusinesses( - {required List businesses}) { - bookmarkedBusinesses = businesses; - notifyListeners(); - } - - void setFavouriteBusinesses({ - required List businesses, - required Map> businessesImagesUrl, - }) { - favouriteBusinessesList = businesses; - favBusImagesUrl = businessesImagesUrl; - notifyListeners(); - } - - void setSearchedBusinesses({ - required List searchedBusinesses, - required Map> businessesImagesUrl, - }) { - this.searchedBusinesses = searchedBusinesses; - busSearchImagesUrl = businessesImagesUrl; - notifyListeners(); - } - - void setSelectedBusiness({required Business business}) { - selectedBusiness = business; - notifyListeners(); - } - - void setSearchedUsers({ - required List searchedUsers, - required Map> userImagesUrl, - }) { - this.searchedUsers = searchedUsers; - this.userSearchImagesUrl = userImagesUrl; - notifyListeners(); - } - - void setSelectedUser({required AppUser user}) { - selectedUser = user; - notifyListeners(); - } - - void setSearchTerm({required String searchTerm}) { - this.searchTerm = searchTerm; - notifyListeners(); - } - - void setBusinessTypeFilter({required String businessTypeFilter}) { - this.businessTypeFilter = businessTypeFilter; - notifyListeners(); - } -} diff --git a/mih_ui/lib/mih_providers/mzansi_profile_provider.dart b/mih_ui/lib/mih_providers/mzansi_profile_provider.dart deleted file mode 100644 index c35483d8..00000000 --- a/mih_ui/lib/mih_providers/mzansi_profile_provider.dart +++ /dev/null @@ -1,159 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business_employee.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business_user.dart'; -import 'package:mzansi_innovation_hub/mih_objects/profile_link.dart'; -import 'package:mzansi_innovation_hub/mih_objects/user_consent.dart'; - -class MzansiProfileProvider extends ChangeNotifier { - bool personalHome; - int personalIndex; - int businessIndex; - AppUser? user; - String? userProfilePicUrl; - ImageProvider? userProfilePicture; - Business? business; - String? businessProfilePicUrl; - ImageProvider? businessProfilePicture; - BusinessUser? businessUser; - String? businessUserSignatureUrl; - ImageProvider? businessUserSignature; - UserConsent? userConsent; - List? employeeList; - List userSearchResults = []; - bool hideBusinessUserDetails; - List personalLinks = []; - - MzansiProfileProvider({ - this.personalHome = true, - this.personalIndex = 0, - this.businessIndex = 0, - this.hideBusinessUserDetails = true, - }); - - void reset() { - personalHome = true; - personalIndex = 0; - businessIndex = 0; - user = null; - userProfilePicUrl = null; - userProfilePicture = null; - business = null; - businessProfilePicUrl = null; - businessProfilePicture = null; - businessUser = null; - businessUserSignatureUrl = null; - businessUserSignature = null; - userConsent = null; - notifyListeners(); - } - - void setPersonalHome(bool isPersonalHome) { - personalHome = isPersonalHome; - notifyListeners(); - } - - void setPersonalIndex(int index) { - personalIndex = index; - notifyListeners(); - } - - void setBusinessIndex(int index) { - businessIndex = index; - notifyListeners(); - } - - void setUser({ - required AppUser newUser, - }) { - user = newUser; - notifyListeners(); - } - - void setHideBusinessUserDetails(bool hideBusinessUserDetails) { - this.hideBusinessUserDetails = hideBusinessUserDetails; - notifyListeners(); - } - - void setUserProfilePicUrl(String url) { - userProfilePicUrl = url; - userProfilePicture = - url.isNotEmpty ? CachedNetworkImageProvider(url) : null; - notifyListeners(); - } - - void setBusiness({ - Business? newBusiness, - }) { - business = newBusiness; - notifyListeners(); - } - - void setBusinessProfilePicUrl(String url) { - businessProfilePicUrl = url; - businessProfilePicture = - url.isNotEmpty ? CachedNetworkImageProvider(url) : null; - notifyListeners(); - } - - void setBusinessUser({required BusinessUser newBusinessUser}) { - businessUser = newBusinessUser; - notifyListeners(); - } - - void setBusinessUserSignatureUrl(String url) { - businessUserSignatureUrl = url; - businessUserSignature = - url.isNotEmpty ? CachedNetworkImageProvider(url) : null; - notifyListeners(); - } - - void setUserConsent(UserConsent? newUserConsent) { - userConsent = newUserConsent; - notifyListeners(); - } - - void setEmployeeList({required List employeeList}) { - this.employeeList = employeeList; - notifyListeners(); - } - - void addLoyaltyCard({required BusinessEmployee newEmployee}) { - employeeList!.add(newEmployee); - notifyListeners(); - } - - void updateEmplyeeDetails({required BusinessEmployee updatedEmployee}) { - int index = employeeList!.indexWhere((employee) => - employee.business_id == updatedEmployee.business_id && - employee.app_id == updatedEmployee.app_id); - if (index != -1) { - employeeList![index] = updatedEmployee; - notifyListeners(); - } - } - - void deleteEmplyee({required BusinessEmployee deletedEmployee}) { - employeeList!.removeWhere((employee) => - employee.business_id == deletedEmployee.business_id && - employee.app_id == deletedEmployee.app_id); - notifyListeners(); - } - - void addEmployee({required BusinessEmployee newEmployee}) { - employeeList!.add(newEmployee); - notifyListeners(); - } - - void setUserearchResults({required List userSearchResults}) { - this.userSearchResults = userSearchResults; - notifyListeners(); - } - - void setPersonalLinks({required List personalLinks}) { - this.personalLinks = personalLinks; - notifyListeners(); - } -} diff --git a/mih_ui/lib/mih_providers/mzansi_wallet_provider.dart b/mih_ui/lib/mih_providers/mzansi_wallet_provider.dart deleted file mode 100644 index ac9b13ac..00000000 --- a/mih_ui/lib/mih_providers/mzansi_wallet_provider.dart +++ /dev/null @@ -1,49 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_objects/loyalty_card.dart'; - -class MzansiWalletProvider extends ChangeNotifier { - List loyaltyCards; - List favouriteCards; - int toolIndex; - - MzansiWalletProvider({ - this.loyaltyCards = const [], - this.favouriteCards = const [], - this.toolIndex = 0, - }); - - void reset() { - toolIndex = 0; - loyaltyCards = []; - favouriteCards = []; - } - - void setToolIndex(int index) { - toolIndex = index; - notifyListeners(); - } - - void setLoyaltyCards({required List cards}) async { - loyaltyCards = cards; - notifyListeners(); - } - - void setFavouriteCards({required List cards}) async { - favouriteCards = cards; - notifyListeners(); - } - - void deleteLoyaltyCard({required int cardId}) { - loyaltyCards.removeWhere((card) => card.idloyalty_cards == cardId); - notifyListeners(); - } - - void editLoyaltyCard({required MIHLoyaltyCard updatedCard}) { - int index = loyaltyCards.indexWhere( - (card) => card.idloyalty_cards == updatedCard.idloyalty_cards); - if (index != -1) { - loyaltyCards[index] = updatedCard; - notifyListeners(); - } - } -} diff --git a/mih_ui/lib/mih_providers/ollama_provider.dart b/mih_ui/lib/mih_providers/ollama_provider.dart deleted file mode 100644 index 16e6942f..00000000 --- a/mih_ui/lib/mih_providers/ollama_provider.dart +++ /dev/null @@ -1,183 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter_ai_toolkit/flutter_ai_toolkit.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:ollama_dart/ollama_dart.dart'; -import 'package:cross_file/cross_file.dart'; - -class OllamaProvider extends LlmProvider with ChangeNotifier { - OllamaProvider({ - String? baseUrl, - Map? headers, - Map? queryParams, - required String model, - String? systemPrompt, - bool? think, - }) : _client = OllamaClient( - baseUrl: baseUrl, - headers: headers, - queryParams: queryParams, - ), - _model = model, - _systemPrompt = systemPrompt, - _think = think, - _history = []; - final OllamaClient _client; - final String _model; - final List _history; - final String? _systemPrompt; - final bool? _think; - - @override - Stream generateStream( - String prompt, { - Iterable attachments = const [], - }) async* { - final messages = _mapToOllamaMessages([ - ChatMessage.user(prompt, attachments), - ]); - yield* _generateStream(messages); - } - - Stream speechToText(XFile audioFile) async* { - KenLogger.success("Inside Custom speechToText funtion"); - // 1. Convert the XFile to the attachment format needed for the LLM. - final attachments = [await FileAttachment.fromFile(audioFile)]; - KenLogger.success("added attachment for audio file"); - - // 2. Define the transcription prompt, mirroring the logic from LlmChatView. - const prompt = - 'translate the attached audio to text; provide the result of that ' - 'translation as just the text of the translation itself. be careful to ' - 'separate the background audio from the foreground audio and only ' - 'provide the result of translating the foreground audio.'; - - KenLogger.success("Created Prompt"); - // 3. Use your existing Ollama API call to process the prompt and attachment. - // We are essentially running a new, one-off chat session for transcription. - yield* generateStream( - prompt, - attachments: attachments, - ); - KenLogger.success("done"); - } - - @override - Stream sendMessageStream( - String prompt, { - Iterable attachments = const [], - }) async* { - KenLogger.success("sendMessageStream called with: $prompt"); - final userMessage = ChatMessage.user(prompt, attachments); - final llmMessage = ChatMessage.llm(); - _history.addAll([userMessage, llmMessage]); - notifyListeners(); - KenLogger.success("History after adding messages: ${_history.length}"); - final messages = _mapToOllamaMessages(_history); - final stream = _generateStream(messages); - yield* stream.map((chunk) { - llmMessage.append(chunk); - notifyListeners(); - return chunk; - }); - KenLogger.success("Stream completed for: $prompt"); - notifyListeners(); - } - - @override - Iterable get history => _history; - - void resetChat() { - _history.clear(); - notifyListeners(); - } - - @override - set history(Iterable history) { - _history.clear(); - _history.addAll(history); - notifyListeners(); - } - - Stream _generateStream(List messages) async* { - final allMessages = []; - if (_systemPrompt != null && _systemPrompt.isNotEmpty) { - KenLogger.success("Adding system prompt to the conversation"); - allMessages.add(Message( - role: MessageRole.system, - content: _systemPrompt, - )); - } - allMessages.addAll(messages); - - final stream = _client.generateChatCompletionStream( - request: GenerateChatCompletionRequest( - model: _model, - messages: allMessages, - think: _think, - ), - ); - // final stream = _client.generateChatCompletionStream( - // request: GenerateChatCompletionRequest( - // model: _model, - // messages: messages, - // ), - // ); - - yield* stream.map((res) => res.message.content); - } - - List _mapToOllamaMessages(List messages) { - return messages.map((message) { - switch (message.origin) { - case MessageOrigin.user: - if (message.attachments.isEmpty) { - return Message( - role: MessageRole.user, - content: message.text ?? '', - ); - } - final imageAttachments = []; - final docAttachments = []; - if (message.text != null && message.text!.isNotEmpty) { - docAttachments.add(message.text!); - } - for (final attachment in message.attachments) { - if (attachment is FileAttachment) { - final mimeType = attachment.mimeType.toLowerCase(); - if (mimeType.startsWith('image/')) { - imageAttachments.add(base64Encode(attachment.bytes)); - } else if (mimeType == 'application/pdf' || - mimeType.startsWith('text/')) { - throw LlmFailureException( - "\n\nAww, that file is a little too advanced for us right now ($mimeType)! We're still learning, but we'll get there! Please try sending us a different file type.\n\nHint: We can handle images quite well!", - ); - } - } else { - throw LlmFailureException( - 'Unsupported attachment type: $attachment', - ); - } - } - return Message( - role: MessageRole.user, - content: docAttachments.join(' '), - images: imageAttachments, - ); - - case MessageOrigin.llm: - return Message( - role: MessageRole.assistant, - content: message.text ?? '', - ); - } - }).toList(growable: false); - } - - @override - void dispose() { - _client.endSession(); - super.dispose(); - } -} diff --git a/mih_ui/lib/mih_providers/patient_manager_provider.dart b/mih_ui/lib/mih_providers/patient_manager_provider.dart deleted file mode 100644 index 7081ad3a..00000000 --- a/mih_ui/lib/mih_providers/patient_manager_provider.dart +++ /dev/null @@ -1,101 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_objects/claim_statement_file.dart'; -import 'package:mzansi_innovation_hub/mih_objects/files.dart'; -import 'package:mzansi_innovation_hub/mih_objects/notes.dart'; -import 'package:mzansi_innovation_hub/mih_objects/patient_access.dart'; -import 'package:mzansi_innovation_hub/mih_objects/patients.dart'; - -class PatientManagerProvider extends ChangeNotifier { - int patientProfileIndex; - int patientManagerIndex; - int fileViewerIndex; - bool personalMode; - List? myPaitentList; - Patient? selectedPatient; - String? selectedPatientProfilePictureUrl; - ImageProvider? selectedPatientProfilePicture; - bool hidePatientDetails; - List? consultationNotes; - List? patientDocuments; - List? patientClaimsDocuments; - List patientSearchResults = []; - - PatientManagerProvider({ - this.patientProfileIndex = 0, - this.patientManagerIndex = 0, - this.fileViewerIndex = 0, - this.personalMode = true, - this.hidePatientDetails = true, - }); - - void reset() { - patientProfileIndex = 0; - patientManagerIndex = 0; - personalMode = true; - selectedPatient = null; - } - - void setPatientProfileIndex(int index) { - patientProfileIndex = index; - notifyListeners(); - } - - void setPatientManagerIndex(int index) { - patientManagerIndex = index; - notifyListeners(); - } - - void setFileViewerIndex(int index) { - patientProfileIndex = index; - notifyListeners(); - } - - void setPersonalMode(bool personalMode) { - this.personalMode = personalMode; - notifyListeners(); - } - - void setSelectedPatient({required Patient? selectedPatient}) { - this.selectedPatient = selectedPatient; - notifyListeners(); - } - - void setSelectedPatientProfilePicUrl(String url) { - selectedPatientProfilePictureUrl = url; - selectedPatientProfilePicture = - url.isNotEmpty ? CachedNetworkImageProvider(url) : null; - notifyListeners(); - } - - void setHidePatientDetails(bool hidePatientDetails) { - this.hidePatientDetails = hidePatientDetails; - notifyListeners(); - } - - void setMyPatientList({required List? myPaitentList}) { - this.myPaitentList = myPaitentList ?? []; - notifyListeners(); - } - - void setConsultationNotes({required List? consultationNotes}) { - this.consultationNotes = consultationNotes ?? []; - notifyListeners(); - } - - void setPatientDocuments({required List? patientDocuments}) { - this.patientDocuments = patientDocuments ?? []; - notifyListeners(); - } - - void setClaimsDocuments( - {required List? patientClaimsDocuments}) { - this.patientClaimsDocuments = patientClaimsDocuments ?? []; - notifyListeners(); - } - - void setPatientSearchResults({required List patientSearchResults}) { - this.patientSearchResults = patientSearchResults; - notifyListeners(); - } -} diff --git a/mih_ui/lib/mih_services/mih_access_controls_services.dart b/mih_ui/lib/mih_services/mih_access_controls_services.dart deleted file mode 100644 index ba2ad08f..00000000 --- a/mih_ui/lib/mih_services/mih_access_controls_services.dart +++ /dev/null @@ -1,213 +0,0 @@ -import 'dart:convert'; -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_objects/arguments.dart'; -import 'package:mzansi_innovation_hub/mih_objects/patient_access.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_access_controlls_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_notification_services.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class MihAccessControlsServices { - Future getBusinessAccessListOfPatient( - String app_id, - MihAccessControllsProvider mihAccessColtrollsProvider, - ) async { - final response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/access-requests/personal/patient/$app_id")); - // var errorCode = response.statusCode.toString(); - // print(response.statusCode); - // print(response.body); - - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List patientAccesses = List.from( - l.map((model) => PatientAccess.fromJson(model))); - if (response.statusCode == 200) { - mihAccessColtrollsProvider.setAccessList(patientAccesses); - } - return response.statusCode; - } else { - throw Exception('failed to pull patient access List for business'); - } - } - - /// This function is used to check if a business has access to a specific patients profile. - /// - /// Patameters: String business_id & app_id (app_id of patient). - /// - /// Returns List (List of access that match the above parameters). - static Future> checkBusinessAccessToPatient( - String business_id, - String app_id, - ) async { - final response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/access-requests/patient/check/$business_id?app_id=$app_id")); - // var errorCode = response.statusCode.toString(); - //print(response.body); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List patientAccesses = List.from( - l.map((model) => PatientAccess.fromJson(model))); - return patientAccesses; - } else { - throw Exception('failed to pull patient access for business'); - } - } - - /// This function is used to create patient access and trigger notification to patient - /// - /// Patameters:- - /// String business_id, - /// String app_id, - /// String type, - /// String requested_by, - /// BuildContext context, - /// - /// Returns void (triggers notification of success 201). - static Future addPatientAccessAPICall( - String business_id, - String app_id, - String type, - String requested_by, - bool personalSelected, - BusinessArguments args, - BuildContext context, - ) async { - var response = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/access-requests/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - // business_id: str - // app_id: str - // type: str - // requested_by: str - body: jsonEncode({ - "business_id": business_id, - "app_id": app_id, - "type": type, - "requested_by": requested_by, - }), - ); - if (response.statusCode == 201) { - await MihNotificationApis.addAccessRequestNotificationAPICall( - app_id, requested_by, personalSelected, args, context); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - /// This function is used to reapply for access to patient. - /// - /// Patameters:- - /// String business_id, - /// String app_id, - /// BuildContext context, - /// - /// Returns void (on success 200 navigate to /mih-access ). - static Future reapplyPatientAccessAPICall( - String business_id, - String app_id, - bool personalSelected, - BusinessArguments args, - BuildContext context, - ) async { - var response = await http.put( - Uri.parse("${AppEnviroment.baseApiUrl}/access-requests/re-apply/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - // business_id: str - // app_id: str - // status: str - // approved_by: str - body: jsonEncode({ - "business_id": business_id, - "app_id": app_id, - }), - ); - if (response.statusCode == 200) { - await MihNotificationApis.reapplyAccessRequestNotificationAPICall( - app_id, personalSelected, args, context); - //notification here - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - /// This function is used to UPDATE access the business has. - /// - /// Patameters:- - /// String business_id, - /// String business_name, - /// String app_id, - /// String status, - /// String approved_by, - /// AppUser signedInUser, - /// BuildContext context, - /// - /// Returns void (on success 200 navigate to /mih-access ). - Future updatePatientAccessAPICall( - String business_id, - String business_name, - String app_id, - String status, - String approved_by, - AppUser signedInUser, - BuildContext context, - ) async { - loadingPopUp(context); - var response = await http.put( - Uri.parse( - "${AppEnviroment.baseApiUrl}/access-requests/update/permission/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - // business_id: str - // app_id: str - // status: str - // approved_by: str - body: jsonEncode({ - "business_id": business_id, - "app_id": app_id, - "status": status, - "approved_by": approved_by, - }), - ); - context.pop(); - return response.statusCode; - // if (response.statusCode == 200) { - // //Navigator.of(context).pushNamed('/home'); - // Navigator.of(context).pop(); - // Navigator.of(context).pop(); - // Navigator.of(context).pushNamed( - // '/mih-access', - // arguments: signedInUser, - // ); - // String message = ""; - // if (status == "approved") { - // message = - // "You've successfully approved the access request! $business_name now has access to your profile forever."; - // } else { - // message = - // "You've declined the access request. $business_name will not have access to your profile."; - // } - // successPopUp(message, context); - // } else { - // internetConnectionPopUp(context); - // } - } - - static void loadingPopUp(BuildContext context) { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - } -} diff --git a/mih_ui/lib/mih_services/mih_alert_services.dart b/mih_ui/lib/mih_services/mih_alert_services.dart deleted file mode 100644 index f00481ec..00000000 --- a/mih_ui/lib/mih_services/mih_alert_services.dart +++ /dev/null @@ -1,1316 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; - -class MihAlertServices { - double getPadingBasedOnScreenWidth(BuildContext context) { - var size = MediaQuery.of(context).size; - if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") { - return size.width / 7; // Large screens - } else { - return 25.0; - } - } - - void internetConnectionAlert(BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: getPadingBasedOnScreenWidth(context), - ), - child: MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Icon( - Icons.warning_amber_rounded, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Center( - child: Text( - "Internet Connection Lost!", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Text( - "We seem to be having some trouble connecting you to the internet. This could be due to a temporary outage or an issue with your device's connection.", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ), - ); - }, - ); - } - - void locationPermissionAlert(BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: getPadingBasedOnScreenWidth(context), - ), - child: MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Icon( - Icons.warning_amber_rounded, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Center( - child: Text( - "Location Services Not Enabled", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Text( - !kIsWeb && Platform.isLinux - ? "To get the most out of MIH, we need your location. Please go to your System Settings and enable location services. Once you do that, we can start showing you relevant information based on your location." - : "To get the most out of MIH, we need your location. Please go to the site settings of the app and enable location services. Once you do that, we can start showing you relevant information based on your location.", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ), - ); - }, - ); - } - - void inputErrorAlert(BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: getPadingBasedOnScreenWidth(context), - ), - child: MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Icon( - Icons.warning_amber_rounded, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Center( - child: Text( - "Oops! Looks like some fields are missing.", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Text( - "We noticed that some required fields are still empty. To ensure your request is processed smoothly, please fill out all the highlighted fields before submitting the form again.", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - RichText( - text: TextSpan( - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 15, - fontWeight: FontWeight.bold, - ), - children: [ - TextSpan( - text: "Here's a quick tip: ", - style: TextStyle( - fontStyle: FontStyle.italic, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"))), - const TextSpan( - text: "Look for fields with an asterisk ("), - TextSpan( - text: "*", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"))), - const TextSpan( - text: ") next to them, as these are mandatory."), - ], - ), - ), - const SizedBox(height: 15), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ), - ); - }, - ); - } - - void passwordRequirementAlert(BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: getPadingBasedOnScreenWidth(context), - ), - child: MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Icon( - Icons.warning_amber_rounded, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Center( - child: Text( - "Password Doesn't Meet Requirements", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Text( - "Oops! Your password doesn't quite meet our standards. To keep your account secure, please make sure your password meets the following requirements", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - RichText( - text: TextSpan( - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - children: [ - TextSpan( - text: "Requirements:\n", - style: TextStyle( - fontStyle: FontStyle.italic, - fontSize: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"))), - const TextSpan( - text: "1) Contailes at least 8 characters\n", - ), - const TextSpan( - text: - "2) Contains at least 1 uppercase letter (A-Z)\n", - ), - const TextSpan( - text: - "3) Contains at least 1 lowercase letter (a-z)\n", - ), - const TextSpan( - text: "4) Contains at least 1 number (0-9)\n", - ), - const TextSpan( - text: - "5) Contains at least 1 special character (!@#\$%^&*)\n", - ), - ], - ), - ), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ), - ); - }, - ); - } - - void passwordMatchAlert(BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: getPadingBasedOnScreenWidth(context), - ), - child: MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Icon( - Icons.warning_amber_rounded, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Center( - child: Text( - "Passwords Don't Match", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Text( - "The password and confirm password fields do not match. Please make sure they are identical.", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ), - ); - }, - ); - } - - void loginErrorAlert(BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: getPadingBasedOnScreenWidth(context), - ), - child: MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Icon( - Icons.warning_amber_rounded, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Center( - child: Text( - "Uh oh! Login attempt unsuccessful.", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Text( - "The email address or password you entered doesn't seem to match our records. Please double-check your information and try again.", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 10), - Text( - "Here are some things to keep in mind:", - textAlign: TextAlign.left, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18.0, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 10), - Text( - "1) Are you sure you're using the correct email address associated with your account?\n2) Is your caps lock key on? Passwords are case-sensitive.\n3) If you've forgotten your password, no worries! Click on \"Forgot Password?\" to reset it.", - textAlign: TextAlign.left, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ), - ); - }, - ); - } - - void emailExistsAlert(BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: getPadingBasedOnScreenWidth(context), - ), - child: MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Icon( - Icons.warning_amber_rounded, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Center( - child: Text( - "Email Already Exists", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Text( - "It looks like that email is already registered. Please sign in or try a different email.", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ), - ); - }, - ); - } - - void invalidEmailAlert(BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: getPadingBasedOnScreenWidth(context), - ), - child: MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Icon( - Icons.warning_amber_rounded, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Center( - child: Text( - "Oops! Invalid Email", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Text( - "Looks like there's a little hiccup with that email address. Please double-check that you've entered it correctly, including the \"@\" symbol and a domain (like example@email.com).", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ), - ); - }, - ); - } - - void warningAlert(String title, String message, BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: getPadingBasedOnScreenWidth(context), - ), - child: MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Icon( - Icons.warning_amber_rounded, - size: 150, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Center( - child: Text( - title, - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Text( - message, - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ), - ); - }, - ); - } - - void warningAdvancedAlert( - String title, - String message, - List actions, - BuildContext context, - ) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: getPadingBasedOnScreenWidth(context), - ), - child: MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Icon( - Icons.warning_amber_rounded, - size: 150, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Center( - child: Text( - title, - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Text( - message, - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - Center( - child: Wrap( - spacing: 10.0, - runSpacing: 10.0, - alignment: WrapAlignment.center, - children: actions, - ), - ), - ], - ), - ), - ), - ); - }, - ); - } - - void deleteConfirmationAlert( - String message, - void Function()? onpressed, - BuildContext context, - ) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: getPadingBasedOnScreenWidth(context), - ), - child: MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Icon( - Icons.warning_amber_rounded, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Center( - child: Text( - "Are You Sure?", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Text( - message, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - Wrap( - spacing: 10.0, - runSpacing: 10.0, - alignment: WrapAlignment.center, - children: [ - MihButton( - onPressed: onpressed, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - elevation: 10, - child: Text( - "Delete", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - elevation: 10, - child: Text( - "Cancel", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ], - ), - ), - ), - ); - }, - ); - } - - void successBasicAlert( - String title, - String message, - BuildContext context, - ) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: getPadingBasedOnScreenWidth(context), - ), - child: MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Icon( - Icons.check_circle_outline_rounded, - size: 150, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Text( - title, - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - Center( - child: Text( - message, - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ), - ); - }, - ); - } - - void successAdvancedAlert( - String title, - String message, - List actions, - BuildContext context, - ) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: getPadingBasedOnScreenWidth(context), - ), - child: MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getGreenColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Icon( - Icons.check_circle_outline_rounded, - size: 150, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Text( - title, - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - Center( - child: Text( - message, - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Center( - child: Wrap( - spacing: 10.0, - runSpacing: 10.0, - alignment: WrapAlignment.center, - children: actions, - ), - ), - ], - ), - ), - ), - ); - }, - ); - } - - void errorBasicAlert( - String title, - String message, - BuildContext context, - ) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: getPadingBasedOnScreenWidth(context), - ), - child: MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Icon( - Icons.warning_amber_rounded, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Text( - title, - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - Center( - child: Text( - message, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Center( - child: MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - width: 300, - elevation: 10, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ) - ], - ), - ), - ), - ); - }, - ); - } - - void errorAdvancedAlert( - String title, - String message, - List actions, - BuildContext context, - ) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: getPadingBasedOnScreenWidth(context), - ), - child: MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode != "Dark"), - windowBody: MihSingleChildScroll( - scrollbarOn: true, - child: Column( - children: [ - Icon( - Icons.warning_amber_rounded, - size: 150, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Text( - title, - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - Center( - child: Text( - message, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == - "Dark"), - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Center( - child: Wrap( - spacing: 10.0, - runSpacing: 10.0, - alignment: WrapAlignment.center, - children: actions, - ), - ) - ], - ), - ), - ), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_services/mih_authentication_services.dart b/mih_ui/lib/mih_services/mih_authentication_services.dart deleted file mode 100644 index 08b59175..00000000 --- a/mih_ui/lib/mih_services/mih_authentication_services.dart +++ /dev/null @@ -1,190 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class MihAuthenticationServices { - final baseAPI = AppEnviroment.baseApiUrl; - - Future signUserIn( - String email, - String password, - BuildContext context, - ) async { - //var _backgroundColor = Colors.transparent; - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - var response = await http.post( - Uri.parse("$baseAPI/auth/signin"), - body: - '{"formFields": [{"id": "email","value": "$email"}, {"id": "password","value": "$password"}]}', - headers: { - 'Content-type': 'application/json', - 'Accept': 'application/json', - "Authorization": dotenv.env['SUPERTOKENS_API_KEY'] ?? "", - }, - ); - if (response.statusCode == 200) { - var userSignedin = jsonDecode(response.body); - if (userSignedin["status"] == "OK") { - context.pop(); - return true; - } else { - context.pop(); - return false; - } - } else { - return false; - } - } - - Future forgotPassword( - String email, - ) async { - var response = await http.post( - Uri.parse("$baseAPI/auth/user/password/reset/token"), - body: '{"formFields": [{"id": "email","value": "$email"}]}', - headers: { - 'Content-type': 'application/json', - 'Accept': 'application/json', - }, - ); - if (response.statusCode == 200) { - var userSignedin = jsonDecode(response.body); - if (userSignedin["status"] == "OK") { - return true; - } else { - return false; - } - } else { - return false; - } - } - - Future resetPassword( - String token, - String password, - ) async { - var response = await http.post( - Uri.parse("$baseAPI/auth/user/password/reset"), - body: - '{"method": "token","formFields": [{"id": "password","value": "$password"}],"token": "$token"}', - headers: { - 'Content-type': 'application/json', - 'Accept': 'application/json', - }, - ); - if (response.statusCode == 200) { - var userSignedin = jsonDecode(response.body); - if (userSignedin["status"] == "OK") { - return true; - } else { - return false; - } - } else { - return false; - } - } - - void loginError(String error, BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return AlertDialog( - title: Text(error), - ); - }, - ); - } - - void signUpError(BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) { - return MihPackageWindow( - fullscreen: false, - windowTitle: null, - onWindowTapClose: null, - backgroundColor: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - windowBody: Column( - children: [ - Icon( - Icons.warning_amber_rounded, - size: 100, - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - ), - Center( - child: Text( - "Email Already Exists", - textAlign: TextAlign.center, - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 25, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 15), - Text( - "Here are some things to keep in mind:", - style: TextStyle( - color: MihColors.getRedColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 10), - Text( - "1) Are you sure you're using the correct email address associated with your account?\n2) Is your caps lock key on? Passwords are case-sensitive.\n3) If you've forgotten your password, no worries! Click on \"Forgot Password?\" to reset it.", - textAlign: TextAlign.left, - style: TextStyle( - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - MihButton( - onPressed: () { - context.pop(); - }, - buttonColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - width: 300, - elevation: 10, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ); - }, - ); - } -} diff --git a/mih_ui/lib/mih_services/mih_business_details_services.dart b/mih_ui/lib/mih_services/mih_business_details_services.dart deleted file mode 100644 index f0791454..00000000 --- a/mih_ui/lib/mih_services/mih_business_details_services.dart +++ /dev/null @@ -1,332 +0,0 @@ -import 'dart:convert'; - -import 'package:go_router/go_router.dart'; -import 'package:http/http.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:supertokens_flutter/supertokens.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class MihBusinessDetailsServices { - Future fetchBusinessCount() async { - var response = await http.get( - Uri.parse("${AppEnviroment.baseApiUrl}/business/count/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - ); - if (response.statusCode == 200) { - var jsonBody = jsonDecode(response.body); - return jsonBody['count']; - } else { - return 0; - } - } - - Future> fetchAllBusinessTypes() async { - var response = await http.get( - Uri.parse("${AppEnviroment.baseApiUrl}/business/types/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - ); - if (response.statusCode == 200) { - List jsonList = jsonDecode(response.body); - List businessTypes = - jsonList.map((item) => item['type'].toString()).toList(); - return businessTypes; - } else { - return []; - } - } - - Future> searchBusinesses( - String searchText, - String searchType, - BuildContext context, - ) async { - String newSearchText = "All"; - if (searchText.isNotEmpty) { - newSearchText = searchText; - } - String newSearchType = "All"; - if (searchType.isNotEmpty) { - newSearchType = searchType; - } - if (searchText.isEmpty && searchType.isEmpty) { - return []; - } - var response = await http.get( - Uri.parse( - "${AppEnviroment.baseApiUrl}/business/search/$newSearchType/$newSearchText"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - ); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List businesses = - List.from(l.map((model) => Business.fromJson(model))); - return businesses; - } else { - throw Exception('failed to load users'); - } - } - - Future getBusinessDetailsByUser( - MzansiProfileProvider profileProvider, - ) async { - String app_id = await SuperTokens.getUserId(); - var response = await http.get( - Uri.parse("${AppEnviroment.baseApiUrl}/business/app_id/$app_id"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - ); - if (response.statusCode == 200) { - String body = response.body; - var jsonBody = jsonDecode(body); - Business? business = Business.fromJson(jsonBody); - profileProvider.setBusiness(newBusiness: business); - return business; - } else { - return null; - } - } - - Future getBusinessDetailsByBusinessId( - String business_id, - ) async { - var response = await http.get( - Uri.parse( - "${AppEnviroment.baseApiUrl}/business/business_id/$business_id"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - ); - if (response.statusCode == 200) { - String body = response.body; - var jsonBody = jsonDecode(body); - return Business.fromJson(jsonBody); - } else { - return null; - } - } - - Future createBusinessDetails( - MzansiProfileProvider provider, - String busineName, - String businessType, - String businessRegistrationNo, - String businessPracticeNo, - String businessVatNo, - String businessEmail, - String businessPhoneNumber, - String businessLocation, - String businessLogoFilename, - String businessWebsite, - String businessRating, - String businessMissionVision, - BuildContext context, - ) async { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - var response = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/business/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "Name": busineName, - "type": businessType, - "registration_no": businessRegistrationNo, - "logo_name": businessLogoFilename.replaceAll(RegExp(r' '), '-'), - "logo_path": "", - "contact_no": businessPhoneNumber, - "bus_email": businessEmail, - "gps_location": businessLocation, - "practice_no": businessPracticeNo, - "vat_no": businessVatNo, - "website": businessWebsite, - "rating": businessRating, - "mission_vision": businessMissionVision, - }), - ); - context.pop(); - if (response.statusCode == 201) { - int finalStatusCode = await updateBusinessDetailsV2( - jsonDecode(response.body)['business_id'], - busineName, - businessType, - businessRegistrationNo, - businessPracticeNo, - businessVatNo, - businessEmail, - businessPhoneNumber, - businessLocation, - businessLogoFilename, - businessWebsite, - businessRating, - businessMissionVision, - provider, - context, - ); - if (finalStatusCode == 200) { - String logoPath = businessLogoFilename.isNotEmpty - ? "${jsonDecode(response.body)['business_id']}/business_files/$businessLogoFilename" - : ""; - provider.setBusiness( - newBusiness: Business( - jsonDecode(response.body)['business_id'], - busineName, - businessType, - businessRegistrationNo, - businessLogoFilename, - logoPath, - businessPhoneNumber, - businessEmail, - provider.user!.app_id, - businessLocation, - businessPracticeNo, - businessVatNo, - businessWebsite, - businessRating, - businessMissionVision, - ), - ); - } - } - return response; - } - - Future updateBusinessDetailsV2( - String business_id, - String business_name, - String business_type, - String business_registration_no, - String business_practice_no, - String business_vat_no, - String business_email, - String business_phone_number, - String business_location, - String business_logo_name, - String businessWebsite, - String businessRating, - String businessMissionVision, - MzansiProfileProvider provider, - BuildContext context, - ) async { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - var filePath = - "$business_id/business_files/${business_logo_name.replaceAll(RegExp(r' '), '-')}"; - var response = await http.put( - Uri.parse("${AppEnviroment.baseApiUrl}/business/update/v2/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "business_id": business_id, - "Name": business_name, - "type": business_type, - "registration_no": business_registration_no, - "logo_name": business_logo_name.replaceAll(RegExp(r' '), '-'), - "logo_path": filePath, - "contact_no": business_phone_number, - "bus_email": business_email, - "gps_location": business_location, - "practice_no": business_practice_no, - "vat_no": business_vat_no, - "website": businessWebsite, - "rating": businessRating, - "mission_vision": businessMissionVision, - }), - ); - context.pop(); - if (response.statusCode == 200) { - provider.setBusiness( - newBusiness: Business( - business_id, - business_name, - business_type, - business_registration_no, - business_logo_name, - filePath, - business_phone_number, - business_email, - business_id, - business_location, - business_practice_no, - business_vat_no, - businessWebsite, - businessRating, - businessMissionVision, - ), - ); - String newProPicUrl = await MihFileApi.getMinioFileUrl(filePath); - provider.setBusinessProfilePicUrl(newProPicUrl); - return 200; - } else { - return 500; - } - } - - Future updateBusinessDetails( - String business_id, - String business_name, - String business_type, - String business_registration_no, - String business_practice_no, - String business_vat_no, - String business_email, - String business_phone_number, - String business_location, - String business_logo_name, - BuildContext context, - ) async { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - var response = await http.put( - Uri.parse("${AppEnviroment.baseApiUrl}/business/update/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "business_id": business_id, - "Name": business_name, - "type": business_type, - "registration_no": business_registration_no, - "logo_name": business_logo_name.replaceAll(RegExp(r' '), '-'), - "logo_path": - "$business_id/business_files/${business_logo_name.replaceAll(RegExp(r' '), '-')}", - "contact_no": business_phone_number, - "bus_email": business_email, - "gps_location": business_location, - "practice_no": business_practice_no, - "vat_no": business_vat_no, - }), - ); - Navigator.of(context).pop(); - if (response.statusCode == 200) { - return 200; - } else { - return 500; - } - } -} diff --git a/mih_ui/lib/mih_services/mih_business_employee_services.dart b/mih_ui/lib/mih_services/mih_business_employee_services.dart deleted file mode 100644 index 72484693..00000000 --- a/mih_ui/lib/mih_services/mih_business_employee_services.dart +++ /dev/null @@ -1,142 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business_employee.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class MihBusinessEmployeeServices { - Future fetchEmployees( - MzansiProfileProvider mzansiProfileProvider, BuildContext context) async { - final response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/business-user/employees/${mzansiProfileProvider.businessUser!.business_id}")); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List employeeList = List.from( - l.map((model) => BusinessEmployee.fromJson(model))); - mzansiProfileProvider.setEmployeeList(employeeList: employeeList); - } else { - throw Exception('failed to load employees'); - } - return response.statusCode; - } - - Future addEmployee( - MzansiProfileProvider provider, - AppUser newEmployee, - String access, - BuildContext context, - ) async { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - var response = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/business-user/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "business_id": provider.business!.business_id, - "app_id": newEmployee.app_id, - "signature": "", - "sig_path": "", - "title": "", - "access": access, - }), - ); - if (response.statusCode == 201) { - provider.addEmployee( - newEmployee: BusinessEmployee( - provider.business!.business_id, - newEmployee.app_id, - "", - access, - newEmployee.fname, - newEmployee.lname, - newEmployee.email, - newEmployee.username, - ), - ); - provider.setBusinessIndex(2); - } - context.pop(); - return response.statusCode; - } - - Future updateEmployeeDetails( - MzansiProfileProvider provider, - BusinessEmployee employee, - String newTitle, - String newAccess, - BuildContext context) async { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - var response = await http.put( - Uri.parse("${AppEnviroment.baseApiUrl}/business-user/employees/update/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "business_id": employee.business_id, - "app_id": employee.app_id, - "title": newTitle, - "access": newAccess, - }), - ); - if (response.statusCode == 200) { - provider.updateEmplyeeDetails( - updatedEmployee: BusinessEmployee( - employee.business_id, - employee.app_id, - newTitle, - newAccess, - employee.fname, - employee.lname, - employee.email, - employee.username, - ), - ); - } - context.pop(); - return response.statusCode; - } - - Future deleteEmployee( - MzansiProfileProvider provider, - BusinessEmployee employee, - BuildContext context, - ) async { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - var response = await http.delete( - Uri.parse("${AppEnviroment.baseApiUrl}/business-user/employees/delete/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "business_id": employee.business_id, - "app_id": employee.app_id, - }), - ); - if (response.statusCode == 200) { - provider.deleteEmplyee(deletedEmployee: employee); - } - context.pop(); - return response.statusCode; - } -} diff --git a/mih_ui/lib/mih_services/mih_claim_statement_generation_services.dart b/mih_ui/lib/mih_services/mih_claim_statement_generation_services.dart deleted file mode 100644 index 9b705d35..00000000 --- a/mih_ui/lib/mih_services/mih_claim_statement_generation_services.dart +++ /dev/null @@ -1,246 +0,0 @@ -import 'dart:convert'; - -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_objects/arguments.dart'; -import 'package:mzansi_innovation_hub/mih_objects/claim_statement_file.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class MIHClaimStatementGenerationApi { - final baseAPI = AppEnviroment.baseApiUrl; - - /// This function is used to generate and store a claim/ statement. - /// - /// Patameters: TBC . - /// - /// Returns TBC. - Future generateClaimStatement( - MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, - ClaimStatementGenerationArguments data, - String env, - BuildContext context, - ) async { - //start loading circle - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - - DateTime now = new DateTime.now(); - // DateTime date = new DateTime(now.year, now.month, now.day); - String fileName = - "${data.document_type}-${data.patient_full_name}-${now.toString().substring(0, 19)}.pdf" - .replaceAll(RegExp(r' '), '-'); - var response1 = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/minio/generate/claim-statement/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "document_type": data.document_type, - "patient_app_id": data.patient_app_id, - "env": env, - "patient_full_name": data.patient_full_name, - "fileName": fileName, - "patient_id_no": data.patient_id_no, - "has_med_aid": data.has_med_aid, - "med_aid_no": data.med_aid_no, - "med_aid_code": data.med_aid_code, - "med_aid_name": data.med_aid_name, - "med_aid_scheme": data.med_aid_scheme, - "busName": data.busName, - "busAddr": data.busAddr, - "busNo": data.busNo, - "busEmail": data.busEmail, - "provider_name": data.provider_name, - "practice_no": data.practice_no, - "vat_no": data.vat_no, - "service_date": data.service_date, - "service_desc": data.service_desc, - "service_desc_option": data.service_desc_option, - "procedure_name": data.procedure_name, - "procedure_additional_info": data.procedure_additional_info, - "icd10_code": data.icd10_code, - "amount": data.amount, - "pre_auth_no": data.pre_auth_no, - "logo_path": data.logo_path, - "sig_path": data.sig_path, - }), - ); - //print(response1.statusCode); - if (response1.statusCode == 200) { - //Update this API - var response2 = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/files/claim-statement/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "app_id": data.patient_app_id, - "business_id": profileProvider.business!.business_id, - "file_path": "${data.patient_app_id}/claims-statements/$fileName", - "file_name": fileName - }), - ); - if (response2.statusCode == 201) { - getClaimStatementFilesByPatient(patientManagerProvider); - String message = - "The ${data.document_type}: $fileName has been successfully generated and added to ${data.patient_full_name}'s record. You can now access and download it for their use."; - MihAlertServices().successBasicAlert( - "Success!", - message, - context, - ); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - /// This function is used to fetch a list of claim/ statement files for a ptient. - /// - /// Patameters: app_id . - /// - /// Returns List. - static Future> getClaimStatementFilesByPatient( - PatientManagerProvider patientManagerProvider, - ) async { - //print("Patien manager page: $endpoint"); - final response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/files/claim-statement/patient/${patientManagerProvider.selectedPatient!.app_id}")); - // print("Here"); - // print("Body: ${response.body}"); - // print("Code: ${response.statusCode}"); - // errorCode = response.statusCode.toString(); - // errorBody = response.body; - - if (response.statusCode == 200) { - //print("Here1"); - Iterable l = jsonDecode(response.body); - //print("Here2"); - List docList = List.from( - l.map((model) => ClaimStatementFile.fromJson(model))); - //print("Here3"); - patientManagerProvider.setClaimsDocuments( - patientClaimsDocuments: docList); - return docList; - } else { - throw Exception( - 'failed to fatch patient claims statement files with api'); - } - } - - /// This function is used to fetch a list of claim/ statement files for a business. - /// - /// Patameters: business_id . - /// - /// Returns List. - static Future> getClaimStatementFilesByBusiness( - String business_id, - ) async { - //print("Patien manager page: $endpoint"); - final response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/files/claim-statement/business/$business_id")); - // print("Here"); - // print("Body: ${response.body}"); - // print("Code: ${response.statusCode}"); - // errorCode = response.statusCode.toString(); - // errorBody = response.body; - - if (response.statusCode == 200) { - //print("Here1"); - Iterable l = jsonDecode(response.body); - //print("Here2"); - List docList = List.from( - l.map((model) => ClaimStatementFile.fromJson(model))); - //print("Here3"); - //print(patientQueue); - return docList; - } else { - throw Exception( - 'failed to fatch business claims statement files with api'); - } - } - - /// This function is used to Delete loyalty card from users mzansi wallet. - /// - /// Patameters:- - /// AppUser signedInUser, - /// int idloyalty_cards, - /// BuildContext context, - /// - /// Returns VOID (TRIGGERS NOTIGICATIOPN ON SUCCESS) - static Future deleteClaimStatementFilesByFileID( - PatientViewArguments args, - String env, - String filePath, - int fileID, - BuildContext context, - ) async { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - // delete file from minio - var response = await http.delete( - Uri.parse("${AppEnviroment.baseApiUrl}/minio/delete/file/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "file_path": filePath, - "env": env, - }), - ); - //print("Here4"); - //print(response.statusCode); - if (response.statusCode == 200) { - //SQL delete - var response2 = await http.delete( - Uri.parse("${AppEnviroment.baseApiUrl}/files/claim-statement/delete/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode( - {"idclaim_statement_file": fileID, "env": env}), - ); - if (response2.statusCode == 200) { - context.pop(); - context.pop(); - context.pop(); - context.pop(); - //print(widget.business); - - context.pushNamed('patientManagerPatient', extra: args); - - // Navigator.of(context) - // .pushNamed('/patient-profile', arguments: widget.signedInUser); - // setState(() {}); - String message = - "The File has been deleted successfully. This means it will no longer be visible on your and cannot be used for future appointments."; - MihAlertServices().successBasicAlert( - "Success!", - message, - context, - ); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } else { - MihAlertServices().internetConnectionAlert(context); - } - } -} -//================== POP UPS ========================================================================== diff --git a/mih_ui/lib/mih_services/mih_currency_exchange_rate_services.dart b/mih_ui/lib/mih_services/mih_currency_exchange_rate_services.dart deleted file mode 100644 index 95173c67..00000000 --- a/mih_ui/lib/mih_services/mih_currency_exchange_rate_services.dart +++ /dev/null @@ -1,80 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_objects/currency.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_calculator_provider.dart'; -import 'package:provider/provider.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class MihCurrencyExchangeRateServices { - static Future> getCurrencyObjectList() async { - final response = await http.get(Uri.parse( - "https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies.min.json")); - if (response.statusCode == 200) { - final Map jsonMap = json.decode(response.body); - List currencies = []; - jsonMap.forEach((code, dynamic nameValue) { - final String name = nameValue is String ? nameValue : 'Unknown Name'; - currencies.add(Currency(code: code, name: name)); - }); - currencies.sort((a, b) => a.name.compareTo(b.name)); - return currencies; - } else { - throw Exception('failed to fatch currencies'); - } - } - - static Future getCurrencyCodeList(BuildContext context) async { - final response = await http.get(Uri.parse( - "https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies.min.json")); - if (response.statusCode == 200) { - final Map jsonMap = json.decode(response.body); - List currencies = []; - jsonMap.forEach((code, dynamic nameValue) { - final String name = nameValue is String ? nameValue : 'Unknown Name'; - currencies.add("$code - $name"); - }); - currencies.sort(); - if (response.statusCode == 200) { - context - .read() - .setAvailableCurrencies(currencies: currencies); - } - } else { - throw Exception('failed to fatch currencies'); - } - } - - static Future> getCurrencyExchangeValue( - String fromCurrencyCode, - String toCurrencyCode, - ) async { - final response = await http.get(Uri.parse( - "https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/$fromCurrencyCode.min.json")); - if (response.statusCode == 200) { - final Map jsonResponse = json.decode(response.body); - final Map? baseCurrencyData = - jsonResponse[fromCurrencyCode]; - final List dateValue = []; - if (baseCurrencyData != null) { - final dynamic rateValue = baseCurrencyData[toCurrencyCode]; - final String date = jsonResponse["date"]; - - if (rateValue is num) { - dateValue.add(date); - dateValue.add(rateValue.toString()); - return dateValue; - } else { - print( - 'Warning: Rate for $toCurrencyCode in $fromCurrencyCode is not a number or missing.'); - return ["Error", "0"]; - } - } else { - throw Exception( - 'Base currency "$fromCurrencyCode" data not found in response.'); - } - } else { - throw Exception('failed to fatch currencies'); - } - } -} diff --git a/mih_ui/lib/mih_services/mih_data_helper_services.dart b/mih_ui/lib/mih_services/mih_data_helper_services.dart deleted file mode 100644 index a2dcc3f6..00000000 --- a/mih_ui/lib/mih_services/mih_data_helper_services.dart +++ /dev/null @@ -1,67 +0,0 @@ -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_my_business_user_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_user_consent_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart'; - -class MihDataHelperServices { - Future getUserData(MzansiProfileProvider profileProvider) async { - String url; - await MihUserServices().getMyUserDetails(profileProvider); - url = await MihFileApi.getMinioFileUrl( - profileProvider.user!.pro_pic_path, - ); - profileProvider.setUserProfilePicUrl(url); - } - - Future getUserConsentStatus( - MzansiProfileProvider profileProvider) async { - await MihUserConsentServices().getUserConsentStatus(profileProvider); - } - - Future getBusinessData(MzansiProfileProvider profileProvider) async { - AppUser? user = profileProvider.user; - String logoUrl; - String signatureUrl; - Business? responseBusiness = await MihBusinessDetailsServices() - .getBusinessDetailsByUser(profileProvider); - if (responseBusiness != null && user!.type == "business") { - logoUrl = await MihFileApi.getMinioFileUrl( - profileProvider.business!.logo_path, - ); - profileProvider.setBusinessProfilePicUrl(logoUrl); - await MihMyBusinessUserServices().getBusinessUser(profileProvider); - signatureUrl = await MihFileApi.getMinioFileUrl( - profileProvider.businessUser!.sig_path, - ); - profileProvider.setBusinessUserSignatureUrl(signatureUrl); - } - } - - Future loadUserDataOnly(MzansiProfileProvider profileProvider) async { - if (profileProvider.user == null) { - await getUserData(profileProvider); - } - if (profileProvider.userConsent == null) { - await getUserConsentStatus(profileProvider); - } - } - - Future loadUserDataWithBusinessesData( - MzansiProfileProvider profileProvider) async { - if (profileProvider.user == null) { - await getUserData(profileProvider); - } - if (profileProvider.userConsent == null) { - await getUserConsentStatus(profileProvider); - } - if (profileProvider.user != null && - profileProvider.user!.type == "business" && - profileProvider.business == null) { - await getBusinessData(profileProvider); - } - } -} diff --git a/mih_ui/lib/mih_services/mih_file_services.dart b/mih_ui/lib/mih_services/mih_file_services.dart deleted file mode 100644 index 9dd0c8a8..00000000 --- a/mih_ui/lib/mih_services/mih_file_services.dart +++ /dev/null @@ -1,127 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; - -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/foundation.dart'; -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:flutter/material.dart'; -import 'package:supertokens_flutter/http.dart' as http; -import 'package:http/http.dart' as http2; -import 'package:supertokens_flutter/supertokens.dart'; - -class MihFileApi { - final baseAPI = AppEnviroment.baseApiUrl; - - static Future getMinioFileUrl( - String filePath, - ) async { - // loadingPopUp(context); - // print("here"); - // var url = - // "${AppEnviroment.baseApiUrl}/minio/pull/file/${AppEnviroment.getEnv()}/$filePath"; - // var response = await http.get(Uri.parse(url)); - String fileUrl = ""; - // print(response.statusCode); - // if (response.statusCode == 200) { - // String body = response.body; - // var decodedData = jsonDecode(body); - - // fileUrl = decodedData['minioURL']; - // } else { - // fileUrl = ""; - // } - // Navigator.of(context).pop(); // Pop loading dialog - // return fileUrl; - try { - var url = - "${AppEnviroment.baseApiUrl}/minio/pull/file/${AppEnviroment.getEnv()}/$filePath"; - var response = await http.get(Uri.parse(url)); - if (response.statusCode == 200) { - var decodedData = jsonDecode(response.body); - fileUrl = decodedData['minioURL']; - } else { - // internetConnectionPopUp(context); - // KenLogger.error("Get File Error: $url"); - // KenLogger.error("Get File Error: ${response.statusCode}"); - // KenLogger.error("Get File Error: ${response.body}"); - } - } catch (e) { - // internetConnectionPopUp(context); - print("Error getting url"); - } finally { - // Navigator.of(context).pop(); // Always pop loading dialog - } - KenLogger.success("File URL: $fileUrl"); - if (AppEnviroment.getEnv() == "Dev" && kIsWeb) { - fileUrl = fileUrl.replaceAll("10.0.2.2", "127.0.0.1"); - } else if (AppEnviroment.getEnv() == "Dev" && Platform.isIOS) { - fileUrl = fileUrl.replaceAll("10.0.2.2", "127.0.0.1"); - } else if (AppEnviroment.getEnv() == "Dev" && Platform.isLinux) { - fileUrl = fileUrl.replaceAll("10.0.2.2", "127.0.0.1"); - } - KenLogger.success("File URL: $fileUrl"); - return fileUrl; - } - - static Future uploadFile( - String app_id, - String env, - String folderName, - PlatformFile? file, - BuildContext context, - ) async { - loadingPopUp(context); - var token = await SuperTokens.getAccessToken(); - var request = http2.MultipartRequest( - 'POST', Uri.parse("${AppEnviroment.baseApiUrl}/minio/upload/file/")); - request.headers['accept'] = 'application/json'; - request.headers['Authorization'] = 'Bearer $token'; - request.headers['Content-Type'] = 'multipart/form-data'; - request.fields['app_id'] = app_id; - request.fields['env'] = env; - request.fields['folder'] = folderName; - request.files.add(await http2.MultipartFile.fromBytes('file', file!.bytes!, - filename: file.name.replaceAll(RegExp(r' '), '-'))); - var response = await request.send(); - context.pop(); // Pop loading dialog - return response.statusCode; - } - - static Future deleteFile( - String app_id, - String env, - String folderName, - String fileName, - BuildContext context, - ) async { - loadingPopUp(context); - var fname = fileName.replaceAll(RegExp(r' '), '-'); - var filePath = "$app_id/$folderName/$fname"; - var response = await http.delete( - Uri.parse("${AppEnviroment.baseApiUrl}/minio/delete/file/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "file_path": filePath, - "env": env, - }), - ); - context.pop(); // Pop loading dialog - return response.statusCode; - } - -//================== POP UPS ========================================================================== - - static void loadingPopUp(BuildContext context) { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - } -} diff --git a/mih_ui/lib/mih_services/mih_icd10_code_services.dart b/mih_ui/lib/mih_services/mih_icd10_code_services.dart deleted file mode 100644 index 8f6ac599..00000000 --- a/mih_ui/lib/mih_services/mih_icd10_code_services.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'dart:convert'; - -import 'package:mzansi_innovation_hub/mih_objects/icd10_code.dart.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:flutter/material.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -import '../mih_config/mih_env.dart'; - -class MIHIcd10CodeApis { - final baseAPI = AppEnviroment.baseApiUrl; - - /// This function is used to fetch a list of icd 10 codes based on a search . - /// - /// Patameters: String search, BuildContext context - /// - /// Returns List. - static Future> getIcd10Codes( - String search, BuildContext context) async { - //print("Patien manager page: $endpoint"); - mihLoadingPopUp(context); - - final response = await http - .get(Uri.parse("${AppEnviroment.baseApiUrl}/icd10-codes/$search")); - // print("Here"); - // print("Body: ${response.body}"); - // print("Code: ${response.statusCode}"); - // errorCode = response.statusCode.toString(); - // errorBody = response.body; - - if (response.statusCode == 200) { - //print("Here1"); - Iterable l = jsonDecode(response.body); - //print("Here2"); - List icd10Codes = - List.from(l.map((model) => ICD10Code.fromJson(model))); - //print("Here3"); - //print(patientQueue); - Navigator.of(context).pop(); - return icd10Codes; - } else { - Navigator.of(context).pop(); - throw Exception('failed to fetch icd-10 codes with api'); - } - } - - static void mihLoadingPopUp(BuildContext context) { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - } -} diff --git a/mih_ui/lib/mih_services/mih_install_services.dart b/mih_ui/lib/mih_services/mih_install_services.dart deleted file mode 100644 index f8aafa28..00000000 --- a/mih_ui/lib/mih_services/mih_install_services.dart +++ /dev/null @@ -1,64 +0,0 @@ -import 'package:flutter/foundation.dart'; -import 'package:flutter/widgets.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:pwa_install/pwa_install.dart'; -// import 'package:universal_html/js.dart' as js; -import 'package:url_launcher/url_launcher.dart'; - -class MihInstallServices { - String? errorMessage; - - Future launchSocialUrl(Uri linkUrl) async { - if (!await launchUrl(linkUrl)) { - throw Exception('Could not launch $linkUrl'); - } - } - - void installMihTrigger(BuildContext context) { - final isWebAndroid = - kIsWeb && (defaultTargetPlatform == TargetPlatform.android); - final isWebIos = kIsWeb && (defaultTargetPlatform == TargetPlatform.iOS); - if (isWebAndroid) { - launchSocialUrl( - Uri.parse( - "https://play.google.com/store/apps/details?id=za.co.mzansiinnovationhub.mih", - ), - ); - } else if (isWebIos) { - //Show pop up for IOS - launchSocialUrl( - Uri.parse( - "https://apps.apple.com/za/app/mzansi-innovation-hub/id6743310890", - ), - ); - } else if (MzansiInnovationHub.of(context)!.theme.getPlatform() == - "Android") { - //Installed Android App - launchSocialUrl( - Uri.parse( - "https://play.google.com/store/apps/details?id=za.co.mzansiinnovationhub.mih", - ), - ); - } else if (MzansiInnovationHub.of(context)!.theme.getPlatform() == "iOS") { - launchSocialUrl( - Uri.parse( - "https://apps.apple.com/za/app/mzansi-innovation-hub/id6743310890", - ), - ); - } else { - //Web - if (PWAInstall().installPromptEnabled) { - try { - PWAInstall().promptInstall_(); - } catch (e) { - errorMessage = e.toString(); - debugPrint('Error prompting install: $e'); - } - } else { - // Fallback for unsupported platforms - debugPrint('Install prompt not available for this platform.'); - } - // js.context.callMethod("presentAddToHome"); - } - } -} diff --git a/mih_ui/lib/mih_services/mih_location_services.dart b/mih_ui/lib/mih_services/mih_location_services.dart deleted file mode 100644 index 4e939419..00000000 --- a/mih_ui/lib/mih_services/mih_location_services.dart +++ /dev/null @@ -1,59 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:geolocator/geolocator.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; - -class MIHLocationAPI { - final LocationSettings locationSettings = const LocationSettings( - accuracy: LocationAccuracy.high, - distanceFilter: 100, - ); - - ///This function is to get the current location of the signed in user. - ///First checks the permission, if permission is denied (new user), request permission from user. - ///if user has blocked permission (denied or denied forver), user will get error pop up. - ///if user has granted permission (while in use), function will return Position object. - Future getGPSPosition(BuildContext context) async { - bool serviceEnabled = await Geolocator.isLocationServiceEnabled(); - if (!serviceEnabled && !kIsWeb && Platform.isLinux) { - // Direct the user to their System Settings - MihAlertServices().locationPermissionAlert(context); - return null; - } - print("Before checkPermission"); // Debug - LocationPermission permission = await Geolocator.checkPermission(); - print("After checkPermission: $permission"); // Debug - if (permission == LocationPermission.denied) { - permission = await Geolocator.requestPermission(); - if (permission == LocationPermission.denied) { - MihAlertServices().locationPermissionAlert(context); - return null; - } else if (permission == LocationPermission.deniedForever) { - MihAlertServices().locationPermissionAlert(context); - return null; - } else { - Position location = await Geolocator.getCurrentPosition( - locationSettings: locationSettings); - return location; - } - } else if (permission == LocationPermission.deniedForever) { - MihAlertServices().locationPermissionAlert(context); - return null; - } else { - Position location = await Geolocator.getCurrentPosition( - locationSettings: locationSettings); - return location; - } - } - - double getDistanceInMeaters(String startPosition, String endPosition) { - double startLatitude = double.parse(startPosition.split(", ")[0]); - double startLogitude = double.parse(startPosition.split(", ")[1]); - double endLatitude = double.parse(endPosition.split(", ")[0]); - double endLogitude = double.parse(endPosition.split(", ")[1]); - return Geolocator.distanceBetween( - startLatitude, startLogitude, endLatitude, endLogitude); - } -} diff --git a/mih_ui/lib/mih_services/mih_minesweeper_services.dart b/mih_ui/lib/mih_services/mih_minesweeper_services.dart deleted file mode 100644 index 19edf598..00000000 --- a/mih_ui/lib/mih_services/mih_minesweeper_services.dart +++ /dev/null @@ -1,80 +0,0 @@ -import 'dart:convert'; -import 'package:mzansi_innovation_hub/mih_objects/minesweeper_player_score.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_mine_sweeper_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class MihMinesweeperServices { - Future getTop20Leaderboard( - MihMineSweeperProvider mineSweeperProvider, - ) async { - String difficulty = mineSweeperProvider.difficulty; - var response = await http.get( - Uri.parse( - "${AppEnviroment.baseApiUrl}/minesweeper/leaderboard/top20/$difficulty"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - ); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List leaderboard = - List.from( - l.map((model) => MinesweeperPlayerScore.fromJson(model))); - mineSweeperProvider.setLeaderboard(leaderboard: leaderboard); - } else { - mineSweeperProvider.setLeaderboard(leaderboard: null); - } - return response.statusCode; - } - - Future getMyScoreboard( - MzansiProfileProvider profileProvider, - MihMineSweeperProvider mineSweeperProvider, - ) async { - String difficulty = mineSweeperProvider.difficulty; - var response = await http.get( - Uri.parse( - "${AppEnviroment.baseApiUrl}/minesweeper/leaderboard/top_score/$difficulty/${profileProvider.user!.app_id}"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - ); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List leaderboard = - List.from( - l.map((model) => MinesweeperPlayerScore.fromJson(model))); - mineSweeperProvider.setMyScoreboard(myScoreboard: leaderboard); - } else { - mineSweeperProvider.setMyScoreboard(myScoreboard: null); - } - return response.statusCode; - } - - Future addPlayerScore( - MzansiProfileProvider profileProvider, - MihMineSweeperProvider mineSweeperProvider, - String game_time, - double game_score, - ) async { - DateTime now = DateTime.now(); - String formattedDateTime = now.toString(); - var response = await http.post( - Uri.parse( - "${AppEnviroment.baseApiUrl}/minesweeper/leaderboard/player_score/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "app_id": profileProvider.user!.app_id, - "difficulty": mineSweeperProvider.difficulty, - "game_time": game_time, - "game_score": game_score, - "played_date": formattedDateTime, - }), - ); - return response.statusCode; - } -} diff --git a/mih_ui/lib/mih_services/mih_my_business_user_services.dart b/mih_ui/lib/mih_services/mih_my_business_user_services.dart deleted file mode 100644 index 4c738694..00000000 --- a/mih_ui/lib/mih_services/mih_my_business_user_services.dart +++ /dev/null @@ -1,133 +0,0 @@ -import 'dart:convert'; -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business_user.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:supertokens_flutter/supertokens.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class MihMyBusinessUserServices { - Future getBusinessUser( - MzansiProfileProvider profileProvider, - ) async { - String app_id = await SuperTokens.getUserId(); - var response = await http.get( - Uri.parse("${AppEnviroment.baseApiUrl}/business-user/$app_id"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - ); - if (response.statusCode == 200) { - // KenLogger.success(response.body); - BusinessUser? businessUser = - BusinessUser.fromJson(jsonDecode(response.body)); - profileProvider.setBusinessUser(newBusinessUser: businessUser); - return businessUser; - } else { - return null; - } - } - - Future createBusinessUser( - String business_id, - String app_id, - String signatureFilename, - String title, - String access, - MzansiProfileProvider provider, - BuildContext context, - ) async { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - String filename = signatureFilename.replaceAll(RegExp(r' '), '-'); - String sigPath = "$business_id/business_files/$signatureFilename"; - var response = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/business-user/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "business_id": business_id, - "app_id": app_id, - "signature": filename, - "sig_path": sigPath.replaceAll(RegExp(r' '), '-'), - "title": title, - "access": access, - }), - ); - context.pop(); - if (response.statusCode == 201) { - provider.setBusinessUser( - newBusinessUser: BusinessUser( - 0, business_id, app_id, filename, sigPath, title, access), - ); - return 201; - } else { - MihAlertServices().internetConnectionAlert(context); - return 500; - } - } - - /// This function updates the business user details. - Future updateBusinessUser( - String app_id, - String business_id, - String bUserTitle, - String bUserAccess, - String signatureFileName, - MzansiProfileProvider provider, - BuildContext context, - ) async { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - var filename = signatureFileName.replaceAll(RegExp(r' '), '-'); - var filePath = - "$app_id/business_files/${signatureFileName.replaceAll(RegExp(r' '), '-')}"; - var response = await http.put( - Uri.parse("${AppEnviroment.baseApiUrl}/business-user/update/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "business_id": business_id, - "app_id": app_id, - "signature": filename, - "sig_path": filePath, - "title": bUserTitle, - "access": bUserAccess, - }), - ); - context.pop(); - if (response.statusCode == 200) { - provider.setBusinessUser( - newBusinessUser: BusinessUser( - provider.businessUser!.idbusiness_users, - business_id, - app_id, - filename, - filePath, - bUserTitle, - bUserAccess, - ), - ); - String newProPicUrl = await MihFileApi.getMinioFileUrl(filePath); - provider.setBusinessUserSignatureUrl(newProPicUrl); - return 200; - } else { - MihAlertServices().internetConnectionAlert(context); - return 500; - } - } -} diff --git a/mih_ui/lib/mih_services/mih_mzansi_calendar_services.dart b/mih_ui/lib/mih_services/mih_mzansi_calendar_services.dart deleted file mode 100644 index 255ee4c0..00000000 --- a/mih_ui/lib/mih_services/mih_mzansi_calendar_services.dart +++ /dev/null @@ -1,546 +0,0 @@ -import 'dart:convert'; - -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_objects/appointment.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business_user.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class MihMzansiCalendarApis { - final baseAPI = AppEnviroment.baseApiUrl; - - /// This function is used to fetch a list of appointment for a personal user. - /// - /// Patameters: - /// app_id, - /// date (yyyy-mm-dd), - /// - /// Returns Future>. - static Future getPersonalAppointments( - String app_id, - String date, - MihCalendarProvider mihCalendarProvider, - ) async { - final response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/appointments/personal/$app_id?date=$date")); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List personalAppointments = - List.from(l.map((model) => Appointment.fromJson(model))); - mihCalendarProvider.setPersonalAppointments( - appointments: personalAppointments); - return response.statusCode; - } else { - throw Exception('failed to fatch personal appointments'); - } - } - - /// This function is used to fetch a list of appointment for a personal user. - /// - /// Patameters: - /// app_id, - /// date (yyyy-mm-dd), - /// - /// Returns Future>. - static Future getBusinessAppointments( - String business_id, - bool waitingRoom, - String date, - MihCalendarProvider mihCalendarProvider, - ) async { - final response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/appointments/business/$business_id?date=$date")); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List businessAppointments = - List.from(l.map((model) => Appointment.fromJson(model))); - mihCalendarProvider.setBusinessAppointments( - appointments: businessAppointments); - return response.statusCode; - } else { - throw Exception('failed to fatch business appointments'); - } - } - - /// This function is used to Delete loyalty card from users mzansi Calendar. - /// - /// Patameters:- - /// AppUser signedInUser, - /// int idloyalty_cards, - /// BuildContext context, - /// - /// Returns VOID (TRIGGERS NOTIGICATIOPN ON SUCCESS) - static Future deleteAppointmentAPICall( - AppUser signedInUser, - bool personalSelected, - Business? business, - BusinessUser? businessUser, - bool inWaitingRoom, - int idappointments, - MihCalendarProvider mihCalendarProvider, - BuildContext context, - ) async { - loadingPopUp(context); - var response = await http.delete( - Uri.parse("${AppEnviroment.baseApiUrl}/appointment/delete/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({"idappointments": idappointments}), - ); - context.pop(); - if (response.statusCode == 200) { - if (personalSelected == true) { - mihCalendarProvider.deletePersonalAppointment( - appointmentId: idappointments); - getPersonalAppointments(signedInUser.app_id, - mihCalendarProvider.selectedDay, mihCalendarProvider); - } else { - mihCalendarProvider.deleteBusinessAppointment( - appointmentId: idappointments); - getBusinessAppointments(business!.business_id, inWaitingRoom, - mihCalendarProvider.selectedDay, mihCalendarProvider); - } - } - return response.statusCode; - //print("Here4"); - //print(response.statusCode); - // if (response.statusCode == 200) { - // Navigator.of(context).pop(); - // Navigator.of(context).pop(); - // Navigator.of(context).pop(); - // if (inWaitingRoom == true && personalSelected == false) { - // Navigator.of(context).pushNamed( - // '/patient-manager', - // arguments: PatManagerArguments( - // signedInUser, - // false, - // business, - // businessUser, - // ), - // ); - // } else { - // Navigator.of(context).pushNamed( - // '/calendar', - // arguments: CalendarArguments( - // signedInUser, - // personalSelected, - // business, - // businessUser, - // ), - // ); - // } - // String message = - // "The appointment has been deleted successfully. This means it will no longer be visible in your Calendar."; - // successPopUp(message, context); - // } else { - // internetConnectionPopUp(context); - // } - } - - /// This function is used to add an appointment to users mzansi Calendar. - /// - /// Patameters:- - /// AppUser signedInUser, - /// String app_id, - /// String title, - /// String description, - /// String date, - /// String time, - /// BuildContext context, - /// - /// Returns VOID (TRIGGERS SUCCESS pop up) - static Future addPersonalAppointment( - AppUser signedInUser, - String title, - String description, - String date, - String time, - MihCalendarProvider mihCalendarProvider, - BuildContext context, - ) async { - loadingPopUp(context); - var response = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/appointment/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "app_id": signedInUser.app_id, - "business_id": "", - "title": title, - "description": description, - "date": date, - "time": time, - }), - ); - context.pop(); - if (response.statusCode == 201) { - mihCalendarProvider.addPersonalAppointment( - newAppointment: Appointment( - idappointments: 0, - app_id: signedInUser.app_id, - business_id: "", - date_time: "$date $time", - title: title, - description: description, - ), - ); - } - return response.statusCode; - // if (response.statusCode == 201) { - // Navigator.pop(context); - // Navigator.pop(context); - // Navigator.pop(context); - // String message = - // "Your appointment \"$title\" for the $date $title has been deleted."; - - // // Navigator.pop(context); - // Navigator.of(context).pushNamed( - // '/calendar', - // arguments: CalendarArguments( - // signedInUser, - // true, - // null, - // null, - // ), - // ); - // successPopUp(message, context); - // } else { - // Navigator.pop(context); - // internetConnectionPopUp(context); - // } - } - - /// This function is used to add an appointment to users mzansi Calendar. - /// - /// Patameters:- - /// AppUser signedInUser, - /// String app_id, - /// String title, - /// String description, - /// String date, - /// String time, - /// BuildContext context, - /// - /// Returns VOID (TRIGGERS SUCCESS pop up) - static Future addBusinessAppointment( - AppUser signedInUser, - Business business, - BusinessUser businessUser, - bool inWaitingRoom, - String title, - String description, - String date, - String time, - MihCalendarProvider mihCalendarProvider, - BuildContext context, - ) async { - loadingPopUp(context); - var response = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/appointment/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "app_id": "", - "business_id": business.business_id, - "title": title, - "description": description, - "date": date, - "time": time, - }), - ); - context.pop(); - if (response.statusCode == 201) { - mihCalendarProvider.addBusinessAppointment( - newAppointment: Appointment( - idappointments: 0, - app_id: "", - business_id: business.business_id, - date_time: "$date $time", - title: title, - description: description, - ), - ); - } - return response.statusCode; - } - - /// This function is used to add an appointment to users mzansi Calendar. - /// - /// Patameters:- - /// AppUser signedInUser, - /// String app_id, - /// String title, - /// String description, - /// String date, - /// String time, - /// BuildContext context, - /// - /// Returns VOID (TRIGGERS SUCCESS pop up) - static Future addPatientAppointment( - AppUser signedInUser, - bool personalSelected, - String patientAppId, - String businessId, - String title, - String description, - String date, - String time, - BuildContext context, - ) async { - loadingPopUp(context); - var response = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/appointment/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "app_id": patientAppId, - "business_id": businessId, - "title": title, - "description": description, - "date": date, - "time": time, - }), - ); - context.pop(); - return response.statusCode; - } - - /// This function is used to update an appointment to users mzansi Calendar. - /// - /// Patameters:- - /// AppUser signedInUser, - /// String app_id, - /// int idappointments, - /// String title, - /// String description, - /// String date, - /// String time, - /// BuildContext context, - /// - /// Returns VOID (TRIGGERS SUCCESS pop up) - static Future updatePersonalAppointment( - AppUser signedInUser, - Business? business, - BusinessUser? businessUser, - int idappointments, - String title, - String description, - String date, - String time, - MihCalendarProvider mihCalendarProvider, - BuildContext context, - ) async { - loadingPopUp(context); - var response = await http.put( - Uri.parse("${AppEnviroment.baseApiUrl}/appointment/update/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "idappointments": idappointments, - "title": title, - "description": description, - "date": date, - "time": time, - }), - ); - context.pop(); - if (response.statusCode == 200) { - mihCalendarProvider.editPersonalAppointment( - updatedAppointment: Appointment( - idappointments: idappointments, - app_id: signedInUser.app_id, - business_id: "", - date_time: "$date $time", - title: title, - description: description, - ), - ); - } - return response.statusCode; - // if (response.statusCode == 200) { - // Navigator.pop(context); - // Navigator.pop(context); - // Navigator.pop(context); - // String message = - // "Your appointment \"$title\" has been updates to the $date $title."; - - // Navigator.pop(context); - // Navigator.of(context).pushNamed( - // '/calendar', - // arguments: CalendarArguments( - // signedInUser, - // true, - // business, - // businessUser, - // ), - // ); - // successPopUp(message, context); - // } else { - // Navigator.pop(context); - // internetConnectionPopUp(context); - // } - } - - /// This function is used to update an appointment to users mzansi Calendar. - /// - /// Patameters:- - /// AppUser signedInUser, - /// String app_id, - /// int idappointments, - /// String title, - /// String description, - /// String date, - /// String time, - /// BuildContext context, - /// - /// Returns VOID (TRIGGERS SUCCESS pop up) - static Future updateBusinessAppointment( - AppUser signedInUser, - Business? business, - BusinessUser? businessUser, - int idappointments, - String title, - String description, - String date, - String time, - MihCalendarProvider mihCalendarProvider, - BuildContext context, - ) async { - loadingPopUp(context); - var response = await http.put( - Uri.parse("${AppEnviroment.baseApiUrl}/appointment/update/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "idappointments": idappointments, - "title": title, - "description": description, - "date": date, - "time": time, - }), - ); - context.pop(); - if (response.statusCode == 200) { - mihCalendarProvider.editBusinessAppointment( - updatedAppointment: Appointment( - idappointments: idappointments, - app_id: "", - business_id: business!.business_id, - date_time: "$date $time", - title: title, - description: description, - ), - ); - } - return response.statusCode; - // if (response.statusCode == 200) { - // Navigator.pop(context); - // Navigator.pop(context); - // Navigator.pop(context); - // String message = - // "Your appointment \"$title\" has been updates to the $date $title."; - - // Navigator.pop(context); - // Navigator.of(context).pushNamed( - // '/calendar', - // arguments: CalendarArguments( - // signedInUser, - // false, - // business, - // businessUser, - // ), - // ); - // successPopUp(message, context); - // } else { - // Navigator.pop(context); - // internetConnectionPopUp(context); - // } - } - - /// This function is used to update an appointment to users mzansi Calendar. - /// - /// Patameters:- - /// AppUser signedInUser, - /// String app_id, - /// int idappointments, - /// String title, - /// String description, - /// String date, - /// String time, - /// BuildContext context, - /// - /// Returns VOID (TRIGGERS SUCCESS pop up) - static Future updatePatientAppointment( - AppUser signedInUser, - Business? business, - BusinessUser? businessUser, - int idappointments, - String title, - String description, - String date, - String time, - BuildContext context, - ) async { - loadingPopUp(context); - var response = await http.put( - Uri.parse("${AppEnviroment.baseApiUrl}/appointment/update/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "idappointments": idappointments, - "title": title, - "description": description, - "date": date, - "time": time, - }), - ); - context.pop(); - return response.statusCode; - // if (response.statusCode == 200) { - // Navigator.pop(context); - // Navigator.pop(context); - // Navigator.pop(context); - // Navigator.pop(context); - // String message = - // "Your appointment \"$title\" has been updates to the $date $title."; - - // // Navigator.pop(context); - // Navigator.of(context).pushNamed( - // '/patient-manager', - // arguments: PatManagerArguments( - // signedInUser, - // false, - // business, - // businessUser, - // ), - // ); - // successPopUp(message, context); - // } else { - // Navigator.pop(context); - // internetConnectionPopUp(context); - // } - } - - //================== POP UPS ========================================================================== - - static void loadingPopUp(BuildContext context) { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - } -} diff --git a/mih_ui/lib/mih_services/mih_mzansi_directory_services.dart b/mih_ui/lib/mih_services/mih_mzansi_directory_services.dart deleted file mode 100644 index a959d4b0..00000000 --- a/mih_ui/lib/mih_services/mih_mzansi_directory_services.dart +++ /dev/null @@ -1,220 +0,0 @@ -import 'dart:convert'; -import 'package:mzansi_innovation_hub/mih_objects/bookmarked_business.dart'; -import 'package:mzansi_innovation_hub/mih_objects/business_review.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class MihMzansiDirectoryServices { - final baseAPI = AppEnviroment.baseApiUrl; - -//######################################################## -//# Business Ratings # -//######################################################## - - Future getUserReviewOfBusiness( - String app_id, - String business_id, - ) async { - final response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/mzansi-directory/business-ratings/user/$app_id/$business_id")); - print(response.statusCode); - if (response.statusCode == 200) { - String body = response.body; - var jsonBody = jsonDecode(body); - BusinessReview? busRev = BusinessReview.fromJson(jsonBody); - return busRev; - } else { - return null; - } - } - - Future> getAllReviewsofBusiness( - String business_id, - ) async { - final response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/mzansi-directory/business-ratings/all/$business_id")); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List businessReviews = List.from( - l.map((model) => BusinessReview.fromJson(model))); - return businessReviews; - } else if (response.statusCode == 404) { - return []; - } else { - throw Exception('failed to fetch Business Reviews'); - } - } - - Future addBusinessReview( - String app_id, - String business_id, - String rating_title, - String rating_description, - String rating_score, - String current_rating, - ) async { - var response = await http.post( - Uri.parse( - "${AppEnviroment.baseApiUrl}/mzansi-directory/business-rating/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "app_id": app_id, - "business_id": business_id, - "rating_title": rating_title, - "rating_description": rating_description, - "rating_score": rating_score, - "current_rating": current_rating, - }), - ); - if (response.statusCode == 201) { - return response.statusCode; - } else { - return response.statusCode; - } - } - - Future deleteBusinessReview( - int idbusiness_ratings, - String business_id, - String rating_score, - String current_rating, - ) async { - var response = await http.delete( - Uri.parse( - "${AppEnviroment.baseApiUrl}/mzansi-directory/business-rating/delete/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "idbusiness_ratings": idbusiness_ratings, - "business_id": business_id, - "rating_score": rating_score, - "current_rating": current_rating, - }), - ); - if (response.statusCode == 200) { - return response.statusCode; - } else { - return response.statusCode; - } - } - - Future updateBusinessReview( - int idbusiness_ratings, - String business_id, - String rating_title, - String rating_description, - String rating_new_score, - String rating_old_score, - String current_rating, - ) async { - var response = await http.put( - Uri.parse( - "${AppEnviroment.baseApiUrl}/mzansi-directory/business-rating/update/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "idbusiness_ratings": idbusiness_ratings, - "business_id": business_id, - "rating_title": rating_title, - "rating_description": rating_description, - "rating_new_score": rating_new_score, - "rating_old_score": rating_old_score, - "current_rating": current_rating, - }), - ); - if (response.statusCode == 200) { - return response.statusCode; - } else { - return response.statusCode; - } - } - -//######################################################## -//# Bookmarked Business # -//######################################################## - - Future getUserBookmarkOfBusiness( - String app_id, - String business_id, - ) async { - final response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/mzansi-directory/bookmarked-business/$app_id/$business_id")); - // print(response.statusCode); - if (response.statusCode == 200) { - String body = response.body; - var jsonBody = jsonDecode(body); - BookmarkedBusiness? BookmarkedBus = BookmarkedBusiness.fromJson(jsonBody); - return BookmarkedBus; - } else { - return null; - } - } - - Future> getAllUserBookmarkedBusiness( - String app_id, - MzansiDirectoryProvider directoryProvider, - ) async { - final response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/mzansi-directory/bookmarked-business/user/all/$app_id/")); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List favouriteBusinesses = - List.from( - l.map((model) => BookmarkedBusiness.fromJson(model))); - directoryProvider.setBookmarkedeBusinesses( - businesses: favouriteBusinesses); - return favouriteBusinesses; - } else if (response.statusCode == 404) { - return []; - } else { - throw Exception('failed to fetch User Bookmarked Business'); - } - } - - Future addBookmarkedBusiness( - String app_id, - String business_id, - ) async { - var response = await http.post( - Uri.parse( - "${AppEnviroment.baseApiUrl}/mzansi-directory/bookmarked-business/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "app_id": app_id, - "business_id": business_id, - }), - ); - if (response.statusCode == 201) { - return response.statusCode; - } else { - return response.statusCode; - } - } - - Future deleteBookmarkedBusiness( - int idbookmarked_businesses, - ) async { - var response = await http.delete( - Uri.parse( - "${AppEnviroment.baseApiUrl}/mzansi-directory/bookmarked-business/delete/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "idbookmarked_businesses": idbookmarked_businesses, - }), - ); - if (response.statusCode == 200) { - return response.statusCode; - } else { - return response.statusCode; - } - } -} diff --git a/mih_ui/lib/mih_services/mih_mzansi_wallet_services.dart b/mih_ui/lib/mih_services/mih_mzansi_wallet_services.dart deleted file mode 100644 index 39013ba7..00000000 --- a/mih_ui/lib/mih_services/mih_mzansi_wallet_services.dart +++ /dev/null @@ -1,222 +0,0 @@ -import 'dart:convert'; - -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_objects/loyalty_card.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_wallet_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class MIHMzansiWalletApis { - final baseAPI = AppEnviroment.baseApiUrl; - - static Future getLoyaltyCards( - MzansiWalletProvider walletProvider, - String app_id, - BuildContext context, - ) async { - final response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/mzasni-wallet/loyalty-cards/$app_id")); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List myCards = List.from( - l.map((model) => MIHLoyaltyCard.fromJson(model))); - walletProvider.setLoyaltyCards(cards: myCards); - // return myCards; - } else { - throw Exception('failed to fatch loyalty cards'); - } - } - - static Future getFavouriteLoyaltyCards( - MzansiWalletProvider walletProvider, - String app_id, - BuildContext context, - ) async { - //print("Patien manager page: $endpoint"); - final response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/mzasni-wallet/loyalty-cards/favourites/$app_id")); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List myCards = List.from( - l.map((model) => MIHLoyaltyCard.fromJson(model))); - walletProvider.setFavouriteCards(cards: myCards); - } - // else { - // throw Exception('failed to fatch loyalty cards'); - // } - } - - /// This function is used to Delete loyalty card from users mzansi wallet. - /// - /// Patameters:- - /// AppUser signedInUser, - /// int idloyalty_cards, - /// BuildContext context, - /// - /// Returns VOID (TRIGGERS NOTIGICATIOPN ON SUCCESS) - static Future deleteLoyaltyCardAPICall( - MzansiWalletProvider walletProvider, - AppUser signedInUser, - int idloyalty_cards, - BuildContext context, - ) async { - loadingPopUp(context); - var response = await http.delete( - Uri.parse( - "${AppEnviroment.baseApiUrl}/mzasni-wallet/loyalty-cards/delete/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({"idloyalty_cards": idloyalty_cards}), - ); - //print("Here4"); - //print(response.statusCode); - context.pop(); - if (response.statusCode == 200) { - walletProvider.deleteLoyaltyCard(cardId: idloyalty_cards); - } - return response.statusCode; - // if (response.statusCode == 200) { - // Navigator.of(context).pop(); - // Navigator.of(context).pop(); - // Navigator.of(context).pop(); - // Navigator.of(context).pop(); - // Navigator.of(context).pushNamed( - // '/mzansi-wallet', - // arguments: WalletArguments(signedInUser, navIndex), - // ); - // String message = - // "The loyalty card has been deleted successfully. This means it will no longer be visible in your Mzansi Wallet."; - // successPopUp(message, context); - // } else { - // Navigator.pop(context); - // internetConnectionPopUp(context); - // } - } - - /// This function is used to add a lopyalty card to users mzansi wallet. - /// - /// Patameters:- - /// AppUser signedInUser, - /// String app_id, - /// String shop_name, - /// String card_number, - /// BuildContext context, - /// - /// Returns VOID (TRIGGERS SUCCESS pop up) - static Future addLoyaltyCardAPICall( - MzansiWalletProvider walletProvider, - AppUser signedInUser, - String app_id, - String shop_name, - String card_number, - String favourite, - int priority_index, - String nickname, - BuildContext context, - ) async { - loadingPopUp(context); - var response = await http.post( - Uri.parse( - "${AppEnviroment.baseApiUrl}/mzasni-wallet/loyalty-cards/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "app_id": app_id, - "shop_name": shop_name, - "card_number": card_number, - "favourite": favourite, - "priority_index": priority_index, - "nickname": nickname, - }), - ); - context.pop(); - KenLogger.success("Response: $response"); - if (response.statusCode == 201) { - await getLoyaltyCards(walletProvider, app_id, context); - } - return response.statusCode; - // if (response.statusCode == 201) { - // // Navigator.pop(context); - // // String message = - // // "Your $shop_name Loyalty Card was successfully added to your Mzansi Wallet."; - // // Navigator.pop(context); - // // Navigator.pop(context); - // // Navigator.of(context).pushNamed( - // // '/mzansi-wallet', - // // arguments: WalletArguments(signedInUser, navIndex), - // // ); - // // successPopUp(message, context); - // } else { - // // Navigator.pop(context); - // // internetConnectionPopUp(context); - // } - } - - /// This function is used to Update loyalty card from users mzansi wallet. - /// - /// Patameters:- - /// AppUser signedInUser, - /// int idloyalty_cards, - /// BuildContext context, - /// - /// Returns VOID (TRIGGERS NOTIGICATIOPN ON SUCCESS) - static Future updateLoyaltyCardAPICall( - MzansiWalletProvider walletProvider, - AppUser signedInUser, - int idloyalty_cards, - String shopName, - String favourite, - int priority_index, - String nickname, - String card_number, - BuildContext context, - ) async { - loadingPopUp(context); - var response = await http.put( - Uri.parse( - "${AppEnviroment.baseApiUrl}/mzasni-wallet/loyalty-cards/update/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "idloyalty_cards": idloyalty_cards, - "favourite": favourite, - "priority_index": priority_index, - "nickname": nickname, - "card_number": card_number, - }), - ); - context.pop(); - if (response.statusCode == 200) { - walletProvider.editLoyaltyCard( - updatedCard: MIHLoyaltyCard( - idloyalty_cards: idloyalty_cards, - app_id: signedInUser.app_id, - shop_name: shopName, - card_number: card_number, - favourite: favourite, - priority_index: priority_index, - nickname: nickname, - ), - ); - } - return response.statusCode; - } - - //================== POP UPS ========================================================================== - - static void loadingPopUp(BuildContext context) { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - } -} diff --git a/mih_ui/lib/mih_services/mih_notification_services.dart b/mih_ui/lib/mih_services/mih_notification_services.dart deleted file mode 100644 index b651112d..00000000 --- a/mih_ui/lib/mih_services/mih_notification_services.dart +++ /dev/null @@ -1,319 +0,0 @@ -import 'dart:convert'; - -import 'package:go_router/go_router.dart'; -import 'package:mzansi_innovation_hub/mih_objects/arguments.dart'; -import 'package:mzansi_innovation_hub/mih_objects/notification.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class MihNotificationApis { - final baseAPI = AppEnviroment.baseApiUrl; -//================== Notifications ========================================================================== - - Future> getNotificationByUser( - String app_id, - int notificationAmount, - ) async { - var responseNotification = await http.get( - Uri.parse("$baseAPI/notifications/$app_id?amount=$notificationAmount")); - if (responseNotification.statusCode == 200) { - String body = responseNotification.body; - Iterable l = jsonDecode(body); - List notifications = List.from( - l.map((model) => MIHNotification.fromJson(model))); - return notifications; - } else { - return []; - } - } - - /// This function is used to create notification to patient for access reviews - /// - /// Patameters:- - /// String app_id, - /// String business_name, - /// BuildContext context, - /// - /// Returns void. (ON SUCCESS 201 , NAVIGATE TO /patient-manager) - static Future addAccessRequestNotificationAPICall( - String app_id, - String business_name, - bool personalSelected, - BusinessArguments args, - BuildContext context, - ) async { - var response = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/notifications/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "app_id": app_id, - "notification_type": "Forever Access Request", - "notification_message": - "A new Forever Access Request has been sent by $business_name in order to access your Patient Profile. Please review request.", - "action_path": "/mih-access", - }), - ); - if (response.statusCode == 201) { - String message = - "A request has been sent to the patient advising that you have requested access to their profile. Only once access has been granted will you be able to book an appointment."; - Navigator.of(context).pop(); - context.goNamed( - 'patientManager', - extra: PatManagerArguments( - args.signedInUser, - personalSelected, - args.business, - args.businessUser, - ), - ); - MihAlertServices().successBasicAlert( - "Success!", - message, - context, - ); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - /// This function is used to create notification to patient for access reviews - /// - /// Patameters:- - /// String app_id, - /// String business_name, - /// BuildContext context, - /// - /// Returns void. (ON SUCCESS 201 , NAVIGATE TO /patient-manager) - static Future reapplyAccessRequestNotificationAPICall( - String app_id, - bool personalSelected, - BusinessArguments args, - BuildContext context, - ) async { - var response = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/notifications/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "app_id": app_id, - "notification_type": "Re-applying for Access", - "notification_message": - "${args.business!.Name} is re-applying for access to your Patient Profile. Please review request.", - "action_path": "/mih-access", - }), - ); - if (response.statusCode == 201) { - String message = - "A request has been sent to the patient advising that you have re-applied for access to their profile. Only once access has been granted will you be able to book an appointment."; - Navigator.of(context).pop(); - context.goNamed( - 'patientManager', - extra: PatManagerArguments( - args.signedInUser, - personalSelected, - args.business, - args.businessUser, - ), - ); - // Navigator.of(context).pop(); - // Navigator.of(context).pushNamed( - // '/patient-manager', - // arguments: PatManagerArguments( - // args.signedInUser, - // personalSelected, - // args.business, - // args.businessUser, - // ), - // ); - MihAlertServices().successBasicAlert( - "Success!", - message, - context, - ); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - /// This function is used to create notification to patient for access reviews - /// - /// Patameters:- - /// String app_id, - /// String business_name, - /// String origDate_time, - /// String date, - /// String time, - /// BusinessArguments args, - /// BuildContext context, - /// - /// Returns void. (ON SUCCESS 201 , NAVIGATE TO /patient-manager) - static Future addRescheduledAppointmentNotificationAPICall( - String app_id, - bool personalSelected, - String business_name, - String origDate_time, - String date, - String time, - BusinessArguments args, - BuildContext context, - ) async { - var response = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/notifications/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "app_id": app_id, - "notification_type": "Appointment Rescheduled", - "notification_message": - "Your appointment with $business_name for the ${origDate_time.replaceAll("T", " ").substring(0, origDate_time.length - 3)} has been rescheduled to the ${date} ${time}.", - "action_path": "/appointments", - }), - ); - if (response.statusCode == 201) { - Navigator.of(context).pop(); - Navigator.of(context).pop(); - Navigator.of(context).pop(); - Navigator.of(context).pushNamed( - '/patient-manager', - arguments: PatManagerArguments( - args.signedInUser, - personalSelected, - args.business, - args.businessUser, - ), - ); - String message = "The appointment has been successfully rescheduled."; - - MihAlertServices().successBasicAlert( - "Success!", - message, - context, - ); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - /// This function is used to create notification to patient for access reviews - /// - /// Patameters:- - /// String app_id, - /// String business_name, - /// String origDate_time, - /// String date, - /// String time, - /// BusinessArguments args, - /// BuildContext context, - /// - /// Returns void. (ON SUCCESS 201 , NAVIGATE TO /patient-manager) - static Future addCancelledAppointmentNotificationAPICall( - String app_id, - bool personalSelected, - String date_time, - BusinessArguments args, - BuildContext context, - ) async { - var response = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/notifications/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "app_id": app_id, - "notification_type": "Appointment Cancelled", - "notification_message": - "Your appointment with ${args.business!.Name} for the ${date_time.replaceAll("T", " ")} has been cancelled.", - "action_path": "/appointments", - }), - ); - if (response.statusCode == 201) { - Navigator.of(context).pop(); - Navigator.of(context).pop(); - Navigator.of(context).pop(); - Navigator.of(context).pushNamed( - '/patient-manager', - arguments: PatManagerArguments( - args.signedInUser, - personalSelected, - args.business, - args.businessUser, - ), - ); - String message = - "The appointment has been cancelled successfully. This means it will no longer be visible in your waiting room and calender."; - MihAlertServices().successBasicAlert( - "Success!", - message, - context, - ); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - /// This function is used to create notification to patient for access reviews - /// - /// Patameters:- - /// String app_id, - /// String business_name, - /// String origDate_time, - /// String date, - /// String time, - /// BusinessArguments args, - /// BuildContext context, - /// - /// Returns void. (ON SUCCESS 201 , NAVIGATE TO /patient-manager) - static Future addNewAppointmentNotificationAPICall( - String app_id, - bool personalSelected, - String date, - String time, - BusinessArguments args, - BuildContext context, - ) async { - var response = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/notifications/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "app_id": app_id, - "notification_type": "New Appointment Booked", - "notification_message": - "An appointment with ${args.business!.Name} has been booked for the $date $time.", - "action_path": "/appointments", - }), - ); - if (response.statusCode == 201) { - Navigator.of(context).pop(); - Navigator.of(context).pop(); - Navigator.of(context).pop(); - Navigator.of(context).pop(); - Navigator.of(context).pushNamed( - '/patient-manager', - arguments: PatManagerArguments( - args.signedInUser, - personalSelected, - args.business, - args.businessUser, - ), - ); - String message = - "The appointment was been created successfully. This means it will now be visible in your waiting room and calender."; - MihAlertServices().successBasicAlert( - "Success!", - message, - context, - ); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } -} -//================== POP UPS ========================================================================== diff --git a/mih_ui/lib/mih_services/mih_patient_services.dart b/mih_ui/lib/mih_services/mih_patient_services.dart deleted file mode 100644 index bec56256..00000000 --- a/mih_ui/lib/mih_services/mih_patient_services.dart +++ /dev/null @@ -1,326 +0,0 @@ -import 'dart:convert'; - -import 'package:file_picker/file_picker.dart'; -import 'package:mzansi_innovation_hub/mih_objects/files.dart'; -import 'package:mzansi_innovation_hub/mih_objects/notes.dart'; -import 'package:mzansi_innovation_hub/mih_objects/patient_access.dart'; -import 'package:mzansi_innovation_hub/mih_objects/patients.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:supertokens_flutter/http.dart' as http; - -class MihPatientServices { - final baseAPI = AppEnviroment.baseApiUrl; - - Future getPatientDetails( - String appId, - PatientManagerProvider patientManagerProvider, - ) async { - var response = await http.get( - Uri.parse("${AppEnviroment.baseApiUrl}/patients/$appId"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - ); - if (response.statusCode == 200) { - String body = response.body; - var jsonBody = jsonDecode(body); - Patient patient = Patient.fromJson(jsonBody); - patientManagerProvider.setSelectedPatient(selectedPatient: patient); - return patient; - } else { - return null; - } - } - - static Future> searchPatients( - PatientManagerProvider patientManagerProvider, - String search, - ) async { - final response = await http - .get(Uri.parse("${AppEnviroment.baseApiUrl}/patients/search/$search")); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List patients = - List.from(l.map((model) => Patient.fromJson(model))); - patientManagerProvider.setPatientSearchResults( - patientSearchResults: patients); - return patients; - } else { - throw Exception('failed to load patients'); - } - } - - Future addPatientService( - String id_no, - String fname, - String lname, - String email, - String cell, - String medAid, - String medMainMem, - String medNo, - String medAidCode, - String medName, - String medScheme, - String address, - MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, - ) async { - var response = await http.post( - Uri.parse("$baseAPI/patients/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "id_no": id_no, - "first_name": fname, - "last_name": lname, - "email": email, - "cell_no": cell, - "medical_aid": medAid, - "medical_aid_main_member": medMainMem, - "medical_aid_no": medNo, - "medical_aid_code": medAidCode, - "medical_aid_name": medName, - "medical_aid_scheme": medScheme, - "address": address, - "app_id": profileProvider.user!.app_id, - }), - ); - if (response.statusCode == 201) { - await getPatientDetails( - profileProvider.user!.app_id, patientManagerProvider); - // patientManagerProvider.setSelectedPatient( - // selectedPatient: Patient( - // idpatients: 0, - // id_no: id_no, - // first_name: fname, - // last_name: lname, - // email: email, - // cell_no: cell, - // medical_aid: medAid, - // medical_aid_name: medName, - // medical_aid_no: medNo, - // medical_aid_main_member: medMainMem, - // medical_aid_code: medAidCode, - // medical_aid_scheme: medScheme, - // address: address, - // app_id: profileProvider.user!.app_id, - // ), - // ); - } - return response.statusCode; - } - - Future updatePatientService( - String app_id, - String id_no, - String fname, - String lname, - String email, - String cell, - String medAid, - String medMainMem, - String medNo, - String medAidCode, - String medName, - String medScheme, - String address, - PatientManagerProvider patientManagerProvider, - ) async { - var response = await http.put( - Uri.parse("$baseAPI/patients/update/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "id_no": id_no, - "first_name": fname, - "last_name": lname, - "email": email, - "cell_no": cell, - "medical_aid": medAid, - "medical_aid_main_member": medMainMem, - "medical_aid_no": medNo, - "medical_aid_code": medAidCode, - "medical_aid_name": medName, - "medical_aid_scheme": medScheme, - "address": address, - "app_id": app_id, - }), - ); - if (response.statusCode == 200) { - await getPatientDetails(app_id, patientManagerProvider); - } - return response.statusCode; - } - - Future getPatientConsultationNotes( - PatientManagerProvider patientManagerProvider) async { - final response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/notes/patients/${patientManagerProvider.selectedPatient!.app_id}")); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List notes = - List.from(l.map((model) => Note.fromJson(model))); - patientManagerProvider.setConsultationNotes(consultationNotes: notes); - } - return response.statusCode; - } - - Future addPatientNoteAPICall( - String title, - String noteText, - MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, - ) async { - var response = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/notes/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "note_name": title, - "note_text": noteText, - "doc_office": profileProvider.business!.Name, - "doctor": - "${profileProvider.user!.fname} ${profileProvider.user!.lname}", - "app_id": patientManagerProvider.selectedPatient!.app_id, - }), - ); - if (response.statusCode == 201) { - await getPatientConsultationNotes(patientManagerProvider); - } - return response.statusCode; - } - - Future deletePatientConsultaionNote( - int NoteId, - PatientManagerProvider patientManagerProvider, - ) async { - var response = await http.delete( - Uri.parse("$baseAPI/notes/delete/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({"idpatient_notes": NoteId}), - ); - if (response.statusCode == 201) { - await getPatientConsultationNotes(patientManagerProvider); - } - return response.statusCode; - } - - Future getPatientDocuments( - PatientManagerProvider patientManagerProvider) async { - final response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/patient_files/get/${patientManagerProvider.selectedPatient!.app_id}")); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List patientDocuments = - List.from(l.map((model) => PFile.fromJson(model))); - patientManagerProvider.setPatientDocuments( - patientDocuments: patientDocuments); - } - return response.statusCode; - } - - Future addPatientFile( - PlatformFile? file, - PatientManagerProvider patientManagerProvider, - ) async { - var fname = file!.name.replaceAll(RegExp(r' '), '-'); - var filePath = - "${patientManagerProvider.selectedPatient!.app_id}/patient_files/$fname"; - var response = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/patient_files/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "file_path": filePath, - "file_name": fname, - "app_id": patientManagerProvider.selectedPatient!.app_id - }), - ); - if (response.statusCode == 201) { - await getPatientDocuments(patientManagerProvider); - } - return response.statusCode; - } - - Future generateMedicalCertificate( - String startDate, - String endDate, - String returnDate, - MzansiProfileProvider profileProvider, - PatientManagerProvider patientManagerProvider, - ) async { - DateTime now = DateTime.now(); - String fileName = - "Med-Cert-${patientManagerProvider.selectedPatient!.first_name} ${patientManagerProvider.selectedPatient!.last_name}-${now.toString().substring(0, 19)}.pdf" - .replaceAll(RegExp(r' '), '-'); - var response = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/minio/generate/med-cert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "app_id": patientManagerProvider.selectedPatient!.app_id, - "env": AppEnviroment.getEnv(), - "patient_full_name": - "${patientManagerProvider.selectedPatient!.first_name} ${patientManagerProvider.selectedPatient!.last_name}", - "fileName": fileName, - "id_no": patientManagerProvider.selectedPatient!.id_no, - "docfname": - "DR. ${profileProvider.user!.fname} ${profileProvider.user!.lname}", - "startDate": startDate, - "busName": profileProvider.business!.Name, - "busAddr": "*TO BE ADDED IN THE FUTURE*", - "busNo": profileProvider.business!.contact_no, - "busEmail": profileProvider.business!.bus_email, - "endDate": endDate, - "returnDate": returnDate, - "logo_path": profileProvider.business!.logo_path, - "sig_path": profileProvider.businessUser!.sig_path, - }), - ); - if (response.statusCode == 200) { - var responseAddFiletoDB = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/patient_files/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "file_path": - "${patientManagerProvider.selectedPatient!.app_id}/patient_files/$fileName", - "file_name": fileName, - "app_id": patientManagerProvider.selectedPatient!.app_id - }), - ); - if (responseAddFiletoDB.statusCode == 201) { - await getPatientDocuments(patientManagerProvider); - } - } - return response.statusCode; - } - - Future> getPatientAccessListOfBusiness( - PatientManagerProvider patientManagerProvider, - String business_id, - ) async { - final response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/access-requests/business/patient/$business_id")); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List patientAccesses = List.from( - l.map((model) => PatientAccess.fromJson(model))); - patientManagerProvider.setMyPatientList(myPaitentList: patientAccesses); - return patientAccesses; - } else { - throw Exception('failed to pull patient access List for business'); - } - } -} diff --git a/mih_ui/lib/mih_services/mih_user_consent_services.dart b/mih_ui/lib/mih_services/mih_user_consent_services.dart deleted file mode 100644 index d8104a49..00000000 --- a/mih_ui/lib/mih_services/mih_user_consent_services.dart +++ /dev/null @@ -1,63 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_objects/user_consent.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:supertokens_flutter/http.dart' as http; -import 'package:supertokens_flutter/supertokens.dart'; - -class MihUserConsentServices { - Future getUserConsentStatus( - MzansiProfileProvider profileProvider, - ) async { - var app_id = await SuperTokens.getUserId(); - final response = await http.get( - Uri.parse("${AppEnviroment.baseApiUrl}/user-consent/user/$app_id")); - if (response.statusCode == 200) { - Map userMap = jsonDecode(response.body); - UserConsent userConsent = UserConsent.fromJson(userMap); - profileProvider.setUserConsent(userConsent); - } - } - - Future insertUserConsentStatus( - String latestPrivacyPolicyDate, - String latestTermOfServiceDate, - MzansiProfileProvider provider, - BuildContext context, - ) async { - UserConsent userConsent = UserConsent( - app_id: provider.user!.app_id, - privacy_policy_accepted: DateTime.parse(latestPrivacyPolicyDate), - terms_of_services_accepted: DateTime.parse(latestTermOfServiceDate), - ); - final response = await http.post( - Uri.parse("${AppEnviroment.baseApiUrl}/user-consent/insert/"), - headers: {"Content-Type": "application/json"}, - body: jsonEncode(userConsent.toJson()), - ); - provider.setUserConsent(userConsent); - return response.statusCode; - } - - Future updateUserConsentStatus( - String latestPrivacyPolicyDate, - String latestTermOfServiceDate, - MzansiProfileProvider provider, - BuildContext context, - ) async { - UserConsent userConsent = UserConsent( - app_id: provider.user!.app_id, - privacy_policy_accepted: DateTime.parse(latestPrivacyPolicyDate), - terms_of_services_accepted: DateTime.parse(latestTermOfServiceDate), - ); - final response = await http.put( - Uri.parse("${AppEnviroment.baseApiUrl}/user-consent/update"), - headers: {"Content-Type": "application/json"}, - body: jsonEncode(userConsent.toJson()), - ); - provider.setUserConsent(userConsent); - return response.statusCode; - } -} diff --git a/mih_ui/lib/mih_services/mih_user_services.dart b/mih_ui/lib/mih_services/mih_user_services.dart deleted file mode 100644 index d92c8295..00000000 --- a/mih_ui/lib/mih_services/mih_user_services.dart +++ /dev/null @@ -1,311 +0,0 @@ -import 'dart:convert'; -import 'package:go_router/go_router.dart'; -import 'package:ken_logger/ken_logger.dart'; -import 'package:mzansi_innovation_hub/main.dart'; -import 'package:mzansi_innovation_hub/mih_objects/app_user.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart'; -import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart'; -import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; -import 'package:mzansi_innovation_hub/mih_config/mih_env.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; -import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart'; -import 'package:provider/provider.dart'; -import 'package:supertokens_flutter/http.dart' as http; -import 'package:supertokens_flutter/supertokens.dart'; - -class MihUserServices { - final baseAPI = AppEnviroment.baseApiUrl; - - static Future isUsernameUnique( - String username, - BuildContext context, - ) async { - var response = await http.get(Uri.parse( - "${AppEnviroment.baseApiUrl}/users/validate/username/$username")); - if (response.statusCode == 200) { - String body = response.body; - var jsonBody = jsonDecode(body); - - return jsonBody["available"]; - } else { - throw Exception( - "Error: isUsernameUnique status code ${response.statusCode}"); - } - } - - Future fetchUserCount() async { - var response = await http.get( - Uri.parse("${AppEnviroment.baseApiUrl}/users/count/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - ); - if (response.statusCode == 200) { - var jsonBody = jsonDecode(response.body); - return jsonBody['count']; - } else { - return 0; - } - } - - Future createUser( - String email, - String app_id, - BuildContext context, - ) async { - var response = await http.post( - Uri.parse("$baseAPI/user/insert/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "email": email, - "app_id": app_id, - }), - ); - if (response.statusCode == 201) { - context.goNamed( - 'mihHome', - extra: true, - ); - } else { - MihAlertServices().internetConnectionAlert(context); - } - } - - Future> searchUsers( - MzansiProfileProvider profileProvider, - String searchText, - BuildContext context, - ) async { - var response = await http.get( - Uri.parse("${AppEnviroment.baseApiUrl}/users/search/$searchText"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - ); - if (response.statusCode == 200) { - Iterable l = jsonDecode(response.body); - List users = - List.from(l.map((model) => AppUser.fromJson(model))); - profileProvider.setUserearchResults(userSearchResults: users); - return users; - } else { - throw Exception('failed to load users'); - } - } - - Future getMIHUserDetails( - String app_id, - BuildContext context, - ) async { - var response = await http.get( - Uri.parse("${AppEnviroment.baseApiUrl}/user/$app_id"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - ); - if (response.statusCode == 200) { - String body = response.body; - var jsonBody = jsonDecode(body); - return AppUser.fromJson(jsonBody); - } else { - return null; - } - } - - Future getMyUserDetails( - MzansiProfileProvider profileProvider, - ) async { - String app_id = await SuperTokens.getUserId(); - var response = await http.get( - Uri.parse("${AppEnviroment.baseApiUrl}/user/$app_id"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - ); - if (response.statusCode == 200) { - String body = response.body; - var jsonBody = jsonDecode(body); - profileProvider.setUser( - newUser: AppUser.fromJson(jsonBody), - ); - return AppUser.fromJson(jsonBody); - } else { - return null; - } - } - - Future updateUserV2( - AppUser signedInUser, - String firstName, - String lastName, - String username, - String profilePicture, - String purpose, - bool isBusinessUser, - BuildContext context, - ) async { - var fileName = profilePicture.replaceAll(RegExp(r' '), '-'); - var filePath = "${signedInUser.app_id}/profile_files/$fileName"; - String profileType; - KenLogger.success("is Busines User: $isBusinessUser"); - if (isBusinessUser) { - profileType = "business"; - } else { - profileType = "personal"; - } - KenLogger.success("Profile Type: $profileType"); - var response = await http.put( - Uri.parse("${AppEnviroment.baseApiUrl}/user/update/v2/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "idusers": signedInUser.idUser, - "username": username, - "fnam": firstName, - "lname": lastName, - "type": profileType, - "pro_pic_path": filePath, - "purpose": purpose, - }), - ); - if (response.statusCode == 200) { - context.read().setUser( - newUser: AppUser( - signedInUser.idUser, - signedInUser.email, - firstName, - lastName, - profileType, - signedInUser.app_id, - username, - filePath, - purpose, - ), - ); - String newProPicUrl = await MihFileApi.getMinioFileUrl(filePath); - context.read().setUserProfilePicUrl(newProPicUrl); - return response.statusCode; - } else { - return response.statusCode; - } - } - - Future updateUser( - AppUser signedInUser, - String firstName, - String lastName, - String username, - String profilePicture, - bool isBusinessUser, - BuildContext context, - ) async { - var fileName = profilePicture.replaceAll(RegExp(r' '), '-'); - var filePath = "${signedInUser.app_id}/profile_files/$fileName"; - String profileType; - if (isBusinessUser) { - profileType = "business"; - } else { - profileType = "personal"; - } - var response = await http.put( - Uri.parse("${AppEnviroment.baseApiUrl}/user/update/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "idusers": signedInUser.idUser, - "username": username, - "fnam": firstName, - "lname": lastName, - "type": profileType, - "pro_pic_path": filePath, - }), - ); - if (response.statusCode == 200) { - return response.statusCode; - } else { - return response.statusCode; - } - } - - static Future deleteAccount( - MzansiProfileProvider provider, - BuildContext context, - ) async { - loadingPopUp(context); - var response = await http.delete( - Uri.parse("${AppEnviroment.baseApiUrl}/user/delete/all/"), - headers: { - "Content-Type": "application/json; charset=UTF-8" - }, - body: jsonEncode({ - "app_id": provider.user!.app_id, - "env": AppEnviroment.getEnv(), - }), - ); - - if (response.statusCode == 200) { - await SuperTokens.signOut(completionHandler: (error) { - print(error); - }); - if (await SuperTokens.doesSessionExist() == false) { - successPopUp( - "Account Deleted Successfully", - "Your account has been successfully deleted. We are sorry to see you go, but we respect your decision.", - context, - ); // Show success message. - provider.dispose(); - } - } else { - Navigator.of(context).pop(); // Pop loading dialog - MihAlertServices().internetConnectionAlert(context); - } - } - -//================== POP UPS ========================================================================== - - static void successPopUp(String title, String message, BuildContext context) { - MihAlertServices().successAdvancedAlert( - title, - message, - [ - MihButton( - onPressed: () { - context.goNamed( - 'mihHome', - extra: true, - ); - }, - buttonColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - elevation: 10, - width: 300, - child: Text( - "Dismiss", - style: TextStyle( - color: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - context, - ); - } - - static void loadingPopUp(BuildContext context) { - showDialog( - context: context, - builder: (context) { - return const Mihloadingcircle(); - }, - ); - } -} diff --git a/mih_ui/lib/mih_services/mih_validation_services.dart b/mih_ui/lib/mih_services/mih_validation_services.dart deleted file mode 100644 index 8d750099..00000000 --- a/mih_ui/lib/mih_services/mih_validation_services.dart +++ /dev/null @@ -1,128 +0,0 @@ -class MihValidationServices { - String? isEmpty(String? value) { - if (value == null || value.isEmpty) { - return "This field is required"; - } - return null; - } - - String? validateNoSpecialChars(String? value) { - if (value == null || value.isEmpty) { - return "This field is required"; - } - final specialCharRegex = RegExp(r"^[\w,'& ]+$"); - if (!specialCharRegex.hasMatch(value)) { - return "Only , ' & _ Special characters are allowed"; - } - return null; - } - - String? validateLength(String? value, int maxLength) { - if (value == null || value.isEmpty) { - return "This field is required"; - } - if (value.length > maxLength) { - return "Length must not exceed $maxLength characters"; - } - return null; - } - - String? validateWebsite(String? website, bool required) { - final websiteRegex = RegExp( - r'^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$'); - if (!required && website!.isEmpty) { - return null; - } - if (!websiteRegex.hasMatch(website!)) { - return "Invalid Website Format"; - } - return null; - } - - String? validateEmail(String? email) { - if (email == null || email.isEmpty) { - return "Email is required"; - } - final emailRegex = - RegExp(r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'); - if (!emailRegex.hasMatch(email)) { - return "Invalid Email Format"; - } - return null; - } - - String? validateUsername(String? username) { - String? errorMessage = ""; - if (username == null || username.isEmpty) { - errorMessage += "Username is required"; - return errorMessage; - } - if (!RegExp(r'^[a-zA-Z]').hasMatch(username)) { - errorMessage += "\n• Your username should start with a letter."; - } - if (!RegExp(r'^[a-zA-Z0-9_]+$').hasMatch(username)) { - errorMessage += - "\n• You can use letters, numbers, and/or underscores only."; - } - if (username.length < 6 || username.length > 30) { - errorMessage += "\n• Keep it between 6 and 30 characters."; - } - if (RegExp(r'[@#\$]').hasMatch(username)) { - errorMessage += "\n• Avoid special characters like @, #, or \$."; - } - - if (errorMessage.isEmpty) { - return null; // No errors, username is valid - } - return "Let's create a great username for you!$errorMessage"; - } - - String? validateNumber(String? number, int? minValue, int? maxValue) { - String? errorMessage = ""; - if (number == null || number.isEmpty) { - errorMessage += "This field is required"; - return errorMessage; - } - int? value = int.tryParse(number); - if (value == null) { - errorMessage += "Please enter a valid number"; - return errorMessage; - } - if (value < (minValue ?? 0)) { - errorMessage += "Value must be >= ${minValue ?? 0}"; - } - if (maxValue != null && value > maxValue) { - if (errorMessage.isNotEmpty) errorMessage += "\n"; - errorMessage += "Value must be <= $maxValue"; - } - return errorMessage.isEmpty ? null : errorMessage; - } - - String? validatePassword(String? password) { - String? errorMessage = ""; - if (password == null || password.isEmpty) { - errorMessage += "Password is required"; - return errorMessage; - } - if (password.length < 8) { - errorMessage += "\n• Contains at least 8 characters long"; - } - if (!RegExp(r'[A-Z]').hasMatch(password)) { - errorMessage += "\n• Contains at least 1 uppercase letter"; - } - if (!RegExp(r'[a-z]').hasMatch(password)) { - errorMessage += "\n• Contains at least 1 lowercase letter"; - } - if (!RegExp(r'[0-9]').hasMatch(password)) { - errorMessage += "\n• Contains at least 1 digit"; - } - if (!RegExp(r'[!@#$%^&*]').hasMatch(password)) { - errorMessage += "\n• Contains at least 1 special character (!@#\$%^&*)"; - } - if (errorMessage.isEmpty) { - return null; // No errors, password is valid - } - errorMessage = "Let's create a great password for you!$errorMessage"; - return errorMessage; - } -} diff --git a/mih_ui/linux/.gitignore b/mih_ui/linux/.gitignore deleted file mode 100644 index d3896c98..00000000 --- a/mih_ui/linux/.gitignore +++ /dev/null @@ -1 +0,0 @@ -flutter/ephemeral diff --git a/mih_ui/linux/CMakeLists.txt b/mih_ui/linux/CMakeLists.txt deleted file mode 100644 index 19b43289..00000000 --- a/mih_ui/linux/CMakeLists.txt +++ /dev/null @@ -1,145 +0,0 @@ -# Project-level configuration. -cmake_minimum_required(VERSION 3.10) -project(runner LANGUAGES CXX) - -# The name of the executable created for the application. Change this to change -# the on-disk name of your application. -set(BINARY_NAME "mzansi_innovation_hub") -# The unique GTK application identifier for this application. See: -# https://wiki.gnome.org/HowDoI/ChooseApplicationID -set(APPLICATION_ID "za.co.mzansiinnovationhub.mih") - -# Explicitly opt in to modern CMake behaviors to avoid warnings with recent -# versions of CMake. -cmake_policy(SET CMP0063 NEW) - -# Load bundled libraries from the lib/ directory relative to the binary. -set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") - -# Root filesystem for cross-building. -if(FLUTTER_TARGET_PLATFORM_SYSROOT) - set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) - set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) - set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) - set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) - set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) - set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -endif() - -# Define build configuration options. -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - set(CMAKE_BUILD_TYPE "Debug" CACHE - STRING "Flutter build mode" FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS - "Debug" "Profile" "Release") -endif() - -# Compilation settings that should be applied to most targets. -# -# Be cautious about adding new options here, as plugins use this function by -# default. In most cases, you should add new options to specific targets instead -# of modifying this function. -function(APPLY_STANDARD_SETTINGS TARGET) - target_compile_features(${TARGET} PUBLIC cxx_std_14) - target_compile_options(${TARGET} PRIVATE -Wall -Werror) - target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") - target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") -endfunction() - -# Flutter library and tool build rules. -set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") -add_subdirectory(${FLUTTER_MANAGED_DIR}) - -# System-level dependencies. -find_package(PkgConfig REQUIRED) -pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) - -add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") - -# Define the application target. To change its name, change BINARY_NAME above, -# not the value here, or `flutter run` will no longer work. -# -# Any new source files that you add to the application should be added here. -add_executable(${BINARY_NAME} - "main.cc" - "my_application.cc" - "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" -) - -# Apply the standard set of build settings. This can be removed for applications -# that need different build settings. -apply_standard_settings(${BINARY_NAME}) - -# Add dependency libraries. Add any application-specific dependencies here. -target_link_libraries(${BINARY_NAME} PRIVATE flutter) -target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) - -# Run the Flutter tool portions of the build. This must not be removed. -add_dependencies(${BINARY_NAME} flutter_assemble) - -# Only the install-generated bundle's copy of the executable will launch -# correctly, since the resources must in the right relative locations. To avoid -# people trying to run the unbundled copy, put it in a subdirectory instead of -# the default top-level location. -set_target_properties(${BINARY_NAME} - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" -) - - -# Generated plugin build rules, which manage building the plugins and adding -# them to the application. -include(flutter/generated_plugins.cmake) - - -# === Installation === -# By default, "installing" just makes a relocatable bundle in the build -# directory. -set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) -endif() - -# Start with a clean build bundle directory every time. -install(CODE " - file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") - " COMPONENT Runtime) - -set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") -set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") - -install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" - COMPONENT Runtime) - -install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" - COMPONENT Runtime) - -install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) - -foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) - install(FILES "${bundled_library}" - DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) -endforeach(bundled_library) - -# Copy the native assets provided by the build.dart from all packages. -set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") -install(DIRECTORY "${NATIVE_ASSETS_DIR}" - DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) - -# Fully re-copy the assets directory on each build to avoid having stale files -# from a previous install. -set(FLUTTER_ASSET_DIR_NAME "flutter_assets") -install(CODE " - file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") - " COMPONENT Runtime) -install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" - DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) - -# Install the AOT library on non-Debug builds only. -if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") - install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) -endif() diff --git a/mih_ui/linux/flutter/CMakeLists.txt b/mih_ui/linux/flutter/CMakeLists.txt deleted file mode 100644 index d5bd0164..00000000 --- a/mih_ui/linux/flutter/CMakeLists.txt +++ /dev/null @@ -1,88 +0,0 @@ -# This file controls Flutter-level build steps. It should not be edited. -cmake_minimum_required(VERSION 3.10) - -set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") - -# Configuration provided via flutter tool. -include(${EPHEMERAL_DIR}/generated_config.cmake) - -# TODO: Move the rest of this into files in ephemeral. See -# https://github.com/flutter/flutter/issues/57146. - -# Serves the same purpose as list(TRANSFORM ... PREPEND ...), -# which isn't available in 3.10. -function(list_prepend LIST_NAME PREFIX) - set(NEW_LIST "") - foreach(element ${${LIST_NAME}}) - list(APPEND NEW_LIST "${PREFIX}${element}") - endforeach(element) - set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) -endfunction() - -# === Flutter Library === -# System-level dependencies. -find_package(PkgConfig REQUIRED) -pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) -pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) -pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) - -set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") - -# Published to parent scope for install step. -set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) -set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) -set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) -set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) - -list(APPEND FLUTTER_LIBRARY_HEADERS - "fl_basic_message_channel.h" - "fl_binary_codec.h" - "fl_binary_messenger.h" - "fl_dart_project.h" - "fl_engine.h" - "fl_json_message_codec.h" - "fl_json_method_codec.h" - "fl_message_codec.h" - "fl_method_call.h" - "fl_method_channel.h" - "fl_method_codec.h" - "fl_method_response.h" - "fl_plugin_registrar.h" - "fl_plugin_registry.h" - "fl_standard_message_codec.h" - "fl_standard_method_codec.h" - "fl_string_codec.h" - "fl_value.h" - "fl_view.h" - "flutter_linux.h" -) -list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") -add_library(flutter INTERFACE) -target_include_directories(flutter INTERFACE - "${EPHEMERAL_DIR}" -) -target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") -target_link_libraries(flutter INTERFACE - PkgConfig::GTK - PkgConfig::GLIB - PkgConfig::GIO -) -add_dependencies(flutter flutter_assemble) - -# === Flutter tool backend === -# _phony_ is a non-existent file to force this command to run every time, -# since currently there's no way to get a full input/output list from the -# flutter tool. -add_custom_command( - OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} - ${CMAKE_CURRENT_BINARY_DIR}/_phony_ - COMMAND ${CMAKE_COMMAND} -E env - ${FLUTTER_TOOL_ENVIRONMENT} - "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" - ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} - VERBATIM -) -add_custom_target(flutter_assemble DEPENDS - "${FLUTTER_LIBRARY}" - ${FLUTTER_LIBRARY_HEADERS} -) diff --git a/mih_ui/linux/flutter/generated_plugin_registrant.cc b/mih_ui/linux/flutter/generated_plugin_registrant.cc deleted file mode 100644 index 4f4c5872..00000000 --- a/mih_ui/linux/flutter/generated_plugin_registrant.cc +++ /dev/null @@ -1,31 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#include "generated_plugin_registrant.h" - -#include -#include -#include -#include -#include - -void fl_register_plugins(FlPluginRegistry* registry) { - g_autoptr(FlPluginRegistrar) file_saver_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "FileSaverPlugin"); - file_saver_plugin_register_with_registrar(file_saver_registrar); - g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); - file_selector_plugin_register_with_registrar(file_selector_linux_registrar); - g_autoptr(FlPluginRegistrar) printing_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "PrintingPlugin"); - printing_plugin_register_with_registrar(printing_registrar); - g_autoptr(FlPluginRegistrar) record_linux_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "RecordLinuxPlugin"); - record_linux_plugin_register_with_registrar(record_linux_registrar); - g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); - url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); -} diff --git a/mih_ui/linux/flutter/generated_plugin_registrant.h b/mih_ui/linux/flutter/generated_plugin_registrant.h deleted file mode 100644 index e0f0a47b..00000000 --- a/mih_ui/linux/flutter/generated_plugin_registrant.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#ifndef GENERATED_PLUGIN_REGISTRANT_ -#define GENERATED_PLUGIN_REGISTRANT_ - -#include - -// Registers Flutter plugins. -void fl_register_plugins(FlPluginRegistry* registry); - -#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/mih_ui/linux/flutter/generated_plugins.cmake b/mih_ui/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 8ee15a6f..00000000 --- a/mih_ui/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - file_saver - file_selector_linux - printing - record_linux - url_launcher_linux -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/mih_ui/linux/main.cc b/mih_ui/linux/main.cc deleted file mode 100644 index e7c5c543..00000000 --- a/mih_ui/linux/main.cc +++ /dev/null @@ -1,6 +0,0 @@ -#include "my_application.h" - -int main(int argc, char** argv) { - g_autoptr(MyApplication) app = my_application_new(); - return g_application_run(G_APPLICATION(app), argc, argv); -} diff --git a/mih_ui/linux/my_application.cc b/mih_ui/linux/my_application.cc deleted file mode 100644 index 8f518d2d..00000000 --- a/mih_ui/linux/my_application.cc +++ /dev/null @@ -1,104 +0,0 @@ -#include "my_application.h" - -#include -#ifdef GDK_WINDOWING_X11 -#include -#endif - -#include "flutter/generated_plugin_registrant.h" - -struct _MyApplication { - GtkApplication parent_instance; - char** dart_entrypoint_arguments; -}; - -G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) - -// Implements GApplication::activate. -static void my_application_activate(GApplication* application) { - MyApplication* self = MY_APPLICATION(application); - GtkWindow* window = - GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); - - // Use a header bar when running in GNOME as this is the common style used - // by applications and is the setup most users will be using (e.g. Ubuntu - // desktop). - // If running on X and not using GNOME then just use a traditional title bar - // in case the window manager does more exotic layout, e.g. tiling. - // If running on Wayland assume the header bar will work (may need changing - // if future cases occur). - gboolean use_header_bar = TRUE; -#ifdef GDK_WINDOWING_X11 - GdkScreen* screen = gtk_window_get_screen(window); - if (GDK_IS_X11_SCREEN(screen)) { - const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); - if (g_strcmp0(wm_name, "GNOME Shell") != 0) { - use_header_bar = FALSE; - } - } -#endif - if (use_header_bar) { - GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); - gtk_widget_show(GTK_WIDGET(header_bar)); - gtk_header_bar_set_title(header_bar, "MIH App - Mzansi Innovation Hub"); - gtk_header_bar_set_show_close_button(header_bar, TRUE); - gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); - } else { - gtk_window_set_title(window, "MIH App - Mzansi Innovation Hub"); - } - - gtk_window_set_default_size(window, 1280, 720); - gtk_widget_show(GTK_WIDGET(window)); - - g_autoptr(FlDartProject) project = fl_dart_project_new(); - fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); - - FlView* view = fl_view_new(project); - gtk_widget_show(GTK_WIDGET(view)); - gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); - - fl_register_plugins(FL_PLUGIN_REGISTRY(view)); - - gtk_widget_grab_focus(GTK_WIDGET(view)); -} - -// Implements GApplication::local_command_line. -static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { - MyApplication* self = MY_APPLICATION(application); - // Strip out the first argument as it is the binary name. - self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); - - g_autoptr(GError) error = nullptr; - if (!g_application_register(application, nullptr, &error)) { - g_warning("Failed to register: %s", error->message); - *exit_status = 1; - return TRUE; - } - - g_application_activate(application); - *exit_status = 0; - - return TRUE; -} - -// Implements GObject::dispose. -static void my_application_dispose(GObject* object) { - MyApplication* self = MY_APPLICATION(object); - g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); - G_OBJECT_CLASS(my_application_parent_class)->dispose(object); -} - -static void my_application_class_init(MyApplicationClass* klass) { - G_APPLICATION_CLASS(klass)->activate = my_application_activate; - G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; - G_OBJECT_CLASS(klass)->dispose = my_application_dispose; -} - -static void my_application_init(MyApplication* self) {} - -MyApplication* my_application_new() { - return MY_APPLICATION(g_object_new(my_application_get_type(), - "application-id", APPLICATION_ID, - "flags", G_APPLICATION_NON_UNIQUE, - nullptr)); -} diff --git a/mih_ui/linux/my_application.h b/mih_ui/linux/my_application.h deleted file mode 100644 index 72271d5e..00000000 --- a/mih_ui/linux/my_application.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef FLUTTER_MY_APPLICATION_H_ -#define FLUTTER_MY_APPLICATION_H_ - -#include - -G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, - GtkApplication) - -/** - * my_application_new: - * - * Creates a new Flutter-based application. - * - * Returns: a new #MyApplication. - */ -MyApplication* my_application_new(); - -#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/mih_ui/linux/runner/CMakeLists.txt b/mih_ui/linux/runner/CMakeLists.txt deleted file mode 100644 index e97dabc7..00000000 --- a/mih_ui/linux/runner/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -cmake_minimum_required(VERSION 3.13) -project(runner LANGUAGES CXX) - -# Define the application target. To change its name, change BINARY_NAME in the -# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer -# work. -# -# Any new source files that you add to the application should be added here. -add_executable(${BINARY_NAME} - "main.cc" - "my_application.cc" - "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" -) - -# Apply the standard set of build settings. This can be removed for applications -# that need different build settings. -apply_standard_settings(${BINARY_NAME}) - -# Add preprocessor definitions for the application ID. -add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") - -# Add dependency libraries. Add any application-specific dependencies here. -target_link_libraries(${BINARY_NAME} PRIVATE flutter) -target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) - -target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") diff --git a/mih_ui/linux/runner/main.cc b/mih_ui/linux/runner/main.cc deleted file mode 100644 index e7c5c543..00000000 --- a/mih_ui/linux/runner/main.cc +++ /dev/null @@ -1,6 +0,0 @@ -#include "my_application.h" - -int main(int argc, char** argv) { - g_autoptr(MyApplication) app = my_application_new(); - return g_application_run(G_APPLICATION(app), argc, argv); -} diff --git a/mih_ui/linux/runner/my_application.cc b/mih_ui/linux/runner/my_application.cc deleted file mode 100644 index eded6ced..00000000 --- a/mih_ui/linux/runner/my_application.cc +++ /dev/null @@ -1,130 +0,0 @@ -#include "my_application.h" - -#include -#ifdef GDK_WINDOWING_X11 -#include -#endif - -#include "flutter/generated_plugin_registrant.h" - -struct _MyApplication { - GtkApplication parent_instance; - char** dart_entrypoint_arguments; -}; - -G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) - -// Implements GApplication::activate. -static void my_application_activate(GApplication* application) { - MyApplication* self = MY_APPLICATION(application); - GtkWindow* window = - GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); - - // Use a header bar when running in GNOME as this is the common style used - // by applications and is the setup most users will be using (e.g. Ubuntu - // desktop). - // If running on X and not using GNOME then just use a traditional title bar - // in case the window manager does more exotic layout, e.g. tiling. - // If running on Wayland assume the header bar will work (may need changing - // if future cases occur). - gboolean use_header_bar = TRUE; -#ifdef GDK_WINDOWING_X11 - GdkScreen* screen = gtk_window_get_screen(window); - if (GDK_IS_X11_SCREEN(screen)) { - const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); - if (g_strcmp0(wm_name, "GNOME Shell") != 0) { - use_header_bar = FALSE; - } - } -#endif - if (use_header_bar) { - GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); - gtk_widget_show(GTK_WIDGET(header_bar)); - gtk_header_bar_set_title(header_bar, "mzansi_innovation_hub"); - gtk_header_bar_set_show_close_button(header_bar, TRUE); - gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); - } else { - gtk_window_set_title(window, "mzansi_innovation_hub"); - } - - gtk_window_set_default_size(window, 1280, 720); - gtk_widget_show(GTK_WIDGET(window)); - - g_autoptr(FlDartProject) project = fl_dart_project_new(); - fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); - - FlView* view = fl_view_new(project); - gtk_widget_show(GTK_WIDGET(view)); - gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); - - fl_register_plugins(FL_PLUGIN_REGISTRY(view)); - - gtk_widget_grab_focus(GTK_WIDGET(view)); -} - -// Implements GApplication::local_command_line. -static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { - MyApplication* self = MY_APPLICATION(application); - // Strip out the first argument as it is the binary name. - self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); - - g_autoptr(GError) error = nullptr; - if (!g_application_register(application, nullptr, &error)) { - g_warning("Failed to register: %s", error->message); - *exit_status = 1; - return TRUE; - } - - g_application_activate(application); - *exit_status = 0; - - return TRUE; -} - -// Implements GApplication::startup. -static void my_application_startup(GApplication* application) { - //MyApplication* self = MY_APPLICATION(object); - - // Perform any actions required at application startup. - - G_APPLICATION_CLASS(my_application_parent_class)->startup(application); -} - -// Implements GApplication::shutdown. -static void my_application_shutdown(GApplication* application) { - //MyApplication* self = MY_APPLICATION(object); - - // Perform any actions required at application shutdown. - - G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); -} - -// Implements GObject::dispose. -static void my_application_dispose(GObject* object) { - MyApplication* self = MY_APPLICATION(object); - g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); - G_OBJECT_CLASS(my_application_parent_class)->dispose(object); -} - -static void my_application_class_init(MyApplicationClass* klass) { - G_APPLICATION_CLASS(klass)->activate = my_application_activate; - G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; - G_APPLICATION_CLASS(klass)->startup = my_application_startup; - G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; - G_OBJECT_CLASS(klass)->dispose = my_application_dispose; -} - -static void my_application_init(MyApplication* self) {} - -MyApplication* my_application_new() { - // Set the program name to the application ID, which helps various systems - // like GTK and desktop environments map this running application to its - // corresponding .desktop file. This ensures better integration by allowing - // the application to be recognized beyond its binary name. - g_set_prgname(APPLICATION_ID); - - return MY_APPLICATION(g_object_new(my_application_get_type(), - "application-id", APPLICATION_ID, - "flags", G_APPLICATION_NON_UNIQUE, - nullptr)); -} diff --git a/mih_ui/linux/runner/my_application.h b/mih_ui/linux/runner/my_application.h deleted file mode 100644 index 72271d5e..00000000 --- a/mih_ui/linux/runner/my_application.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef FLUTTER_MY_APPLICATION_H_ -#define FLUTTER_MY_APPLICATION_H_ - -#include - -G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, - GtkApplication) - -/** - * my_application_new: - * - * Creates a new Flutter-based application. - * - * Returns: a new #MyApplication. - */ -MyApplication* my_application_new(); - -#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/mih_ui/macos/.gitignore b/mih_ui/macos/.gitignore deleted file mode 100644 index 746adbb6..00000000 --- a/mih_ui/macos/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -# Flutter-related -**/Flutter/ephemeral/ -**/Pods/ - -# Xcode-related -**/dgph -**/xcuserdata/ diff --git a/mih_ui/macos/Flutter/Flutter-Debug.xcconfig b/mih_ui/macos/Flutter/Flutter-Debug.xcconfig deleted file mode 100644 index 4b81f9b2..00000000 --- a/mih_ui/macos/Flutter/Flutter-Debug.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" -#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/mih_ui/macos/Flutter/Flutter-Release.xcconfig b/mih_ui/macos/Flutter/Flutter-Release.xcconfig deleted file mode 100644 index 5caa9d15..00000000 --- a/mih_ui/macos/Flutter/Flutter-Release.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" -#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/mih_ui/macos/Flutter/GeneratedPluginRegistrant.swift b/mih_ui/macos/Flutter/GeneratedPluginRegistrant.swift deleted file mode 100644 index 3cef27da..00000000 --- a/mih_ui/macos/Flutter/GeneratedPluginRegistrant.swift +++ /dev/null @@ -1,56 +0,0 @@ -// -// Generated file. Do not edit. -// - -import FlutterMacOS -import Foundation - -import app_settings -import device_info_plus -import file_picker -import file_saver -import file_selector_macos -import firebase_app_check -import firebase_auth -import firebase_core -import flutter_tts -import geolocator_apple -import local_auth_darwin -import mobile_scanner -import package_info_plus -import path_provider_foundation -import printing -import record_macos -import screen_brightness_macos -import share_plus -import shared_preferences_foundation -import sqflite_darwin -import syncfusion_pdfviewer_macos -import url_launcher_macos -import webview_flutter_wkwebview - -func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { - AppSettingsPlugin.register(with: registry.registrar(forPlugin: "AppSettingsPlugin")) - DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) - FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin")) - FileSaverPlugin.register(with: registry.registrar(forPlugin: "FileSaverPlugin")) - FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) - FLTFirebaseAppCheckPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAppCheckPlugin")) - FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) - FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) - FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin")) - GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) - FLALocalAuthPlugin.register(with: registry.registrar(forPlugin: "FLALocalAuthPlugin")) - MobileScannerPlugin.register(with: registry.registrar(forPlugin: "MobileScannerPlugin")) - FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) - PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) - PrintingPlugin.register(with: registry.registrar(forPlugin: "PrintingPlugin")) - RecordMacOsPlugin.register(with: registry.registrar(forPlugin: "RecordMacOsPlugin")) - ScreenBrightnessMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenBrightnessMacosPlugin")) - SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) - SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) - SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) - SyncfusionFlutterPdfViewerPlugin.register(with: registry.registrar(forPlugin: "SyncfusionFlutterPdfViewerPlugin")) - UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) - WebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "WebViewFlutterPlugin")) -} diff --git a/mih_ui/macos/Podfile b/mih_ui/macos/Podfile deleted file mode 100644 index 29c8eb32..00000000 --- a/mih_ui/macos/Podfile +++ /dev/null @@ -1,42 +0,0 @@ -platform :osx, '10.14' - -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -project 'Runner', { - 'Debug' => :debug, - 'Profile' => :release, - 'Release' => :release, -} - -def flutter_root - generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) - unless File.exist?(generated_xcode_build_settings_path) - raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" - end - - File.foreach(generated_xcode_build_settings_path) do |line| - matches = line.match(/FLUTTER_ROOT\=(.*)/) - return matches[1].strip if matches - end - raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" -end - -require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) - -flutter_macos_podfile_setup - -target 'Runner' do - use_frameworks! - - flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) - target 'RunnerTests' do - inherit! :search_paths - end -end - -post_install do |installer| - installer.pods_project.targets.each do |target| - flutter_additional_macos_build_settings(target) - end -end diff --git a/mih_ui/macos/Runner.xcodeproj/project.pbxproj b/mih_ui/macos/Runner.xcodeproj/project.pbxproj deleted file mode 100644 index 23af1321..00000000 --- a/mih_ui/macos/Runner.xcodeproj/project.pbxproj +++ /dev/null @@ -1,699 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 54; - objects = { - -/* Begin PBXAggregateTarget section */ - 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { - isa = PBXAggregateTarget; - buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; - buildPhases = ( - 33CC111E2044C6BF0003C045 /* ShellScript */, - ); - dependencies = ( - ); - name = "Flutter Assemble"; - productName = FLX; - }; -/* End PBXAggregateTarget section */ - -/* Begin PBXBuildFile section */ - 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; - 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; - 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; - 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; - 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; - 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; - 87A3ECC0300895438D998868 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 7ED8EFF855C30D0E25B6A6B4 /* GoogleService-Info.plist */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 33CC10E52044A3C60003C045 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 33CC10EC2044A3C60003C045; - remoteInfo = Runner; - }; - 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 33CC10E52044A3C60003C045 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 33CC111A2044C6BA0003C045; - remoteInfo = FLX; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 33CC110E2044A8840003C045 /* Bundle Framework */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - ); - name = "Bundle Framework"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; - 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; - 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* patient_manager.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = patient_manager.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; - 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; - 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; - 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; - 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; - 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; - 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; - 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; - 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; - 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; - 7ED8EFF855C30D0E25B6A6B4 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; - 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 331C80D2294CF70F00263BE5 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 33CC10EA2044A3C60003C045 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 331C80D6294CF71000263BE5 /* RunnerTests */ = { - isa = PBXGroup; - children = ( - 331C80D7294CF71000263BE5 /* RunnerTests.swift */, - ); - path = RunnerTests; - sourceTree = ""; - }; - 33BA886A226E78AF003329D5 /* Configs */ = { - isa = PBXGroup; - children = ( - 33E5194F232828860026EE4D /* AppInfo.xcconfig */, - 9740EEB21CF90195004384FC /* Debug.xcconfig */, - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, - 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, - ); - path = Configs; - sourceTree = ""; - }; - 33CC10E42044A3C60003C045 = { - isa = PBXGroup; - children = ( - 33FAB671232836740065AC1E /* Runner */, - 33CEB47122A05771004F2AC0 /* Flutter */, - 331C80D6294CF71000263BE5 /* RunnerTests */, - 33CC10EE2044A3C60003C045 /* Products */, - D73912EC22F37F3D000D13A0 /* Frameworks */, - 7ED8EFF855C30D0E25B6A6B4 /* GoogleService-Info.plist */, - ); - sourceTree = ""; - }; - 33CC10EE2044A3C60003C045 /* Products */ = { - isa = PBXGroup; - children = ( - 33CC10ED2044A3C60003C045 /* patient_manager.app */, - 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 33CC11242044D66E0003C045 /* Resources */ = { - isa = PBXGroup; - children = ( - 33CC10F22044A3C60003C045 /* Assets.xcassets */, - 33CC10F42044A3C60003C045 /* MainMenu.xib */, - 33CC10F72044A3C60003C045 /* Info.plist */, - ); - name = Resources; - path = ..; - sourceTree = ""; - }; - 33CEB47122A05771004F2AC0 /* Flutter */ = { - isa = PBXGroup; - children = ( - 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, - 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, - 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, - 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, - ); - path = Flutter; - sourceTree = ""; - }; - 33FAB671232836740065AC1E /* Runner */ = { - isa = PBXGroup; - children = ( - 33CC10F02044A3C60003C045 /* AppDelegate.swift */, - 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, - 33E51913231747F40026EE4D /* DebugProfile.entitlements */, - 33E51914231749380026EE4D /* Release.entitlements */, - 33CC11242044D66E0003C045 /* Resources */, - 33BA886A226E78AF003329D5 /* Configs */, - ); - path = Runner; - sourceTree = ""; - }; - D73912EC22F37F3D000D13A0 /* Frameworks */ = { - isa = PBXGroup; - children = ( - ); - name = Frameworks; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 331C80D4294CF70F00263BE5 /* RunnerTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; - buildPhases = ( - 331C80D1294CF70F00263BE5 /* Sources */, - 331C80D2294CF70F00263BE5 /* Frameworks */, - 331C80D3294CF70F00263BE5 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 331C80DA294CF71000263BE5 /* PBXTargetDependency */, - ); - name = RunnerTests; - productName = RunnerTests; - productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 33CC10EC2044A3C60003C045 /* Runner */ = { - isa = PBXNativeTarget; - buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; - buildPhases = ( - 33CC10E92044A3C60003C045 /* Sources */, - 33CC10EA2044A3C60003C045 /* Frameworks */, - 33CC10EB2044A3C60003C045 /* Resources */, - 33CC110E2044A8840003C045 /* Bundle Framework */, - 3399D490228B24CF009A79C7 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - 33CC11202044C79F0003C045 /* PBXTargetDependency */, - ); - name = Runner; - productName = Runner; - productReference = 33CC10ED2044A3C60003C045 /* patient_manager.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 33CC10E52044A3C60003C045 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1510; - ORGANIZATIONNAME = ""; - TargetAttributes = { - 331C80D4294CF70F00263BE5 = { - CreatedOnToolsVersion = 14.0; - TestTargetID = 33CC10EC2044A3C60003C045; - }; - 33CC10EC2044A3C60003C045 = { - CreatedOnToolsVersion = 9.2; - LastSwiftMigration = 1100; - ProvisioningStyle = Automatic; - SystemCapabilities = { - com.apple.Sandbox = { - enabled = 1; - }; - }; - }; - 33CC111A2044C6BA0003C045 = { - CreatedOnToolsVersion = 9.2; - ProvisioningStyle = Manual; - }; - }; - }; - buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 33CC10E42044A3C60003C045; - productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 33CC10EC2044A3C60003C045 /* Runner */, - 331C80D4294CF70F00263BE5 /* RunnerTests */, - 33CC111A2044C6BA0003C045 /* Flutter Assemble */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 331C80D3294CF70F00263BE5 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 33CC10EB2044A3C60003C045 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, - 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, - 87A3ECC0300895438D998868 /* GoogleService-Info.plist in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 3399D490228B24CF009A79C7 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; - }; - 33CC111E2044C6BF0003C045 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - Flutter/ephemeral/FlutterInputs.xcfilelist, - ); - inputPaths = ( - Flutter/ephemeral/tripwire, - ); - outputFileListPaths = ( - Flutter/ephemeral/FlutterOutputs.xcfilelist, - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 331C80D1294CF70F00263BE5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 33CC10E92044A3C60003C045 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, - 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, - 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 33CC10EC2044A3C60003C045 /* Runner */; - targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; - }; - 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; - targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - 33CC10F52044A3C60003C045 /* Base */, - ); - name = MainMenu.xib; - path = Runner; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 331C80DB294CF71000263BE5 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.patientManager.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/patient_manager.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/patient_manager"; - }; - name = Debug; - }; - 331C80DC294CF71000263BE5 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.patientManager.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/patient_manager.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/patient_manager"; - }; - name = Release; - }; - 331C80DD294CF71000263BE5 /* Profile */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.patientManager.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/patient_manager.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/patient_manager"; - }; - name = Profile; - }; - 338D0CE9231458BD00FA5F75 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - }; - name = Profile; - }; - 338D0CEA231458BD00FA5F75 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 5.0; - }; - name = Profile; - }; - 338D0CEB231458BD00FA5F75 /* Profile */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Manual; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Profile; - }; - 33CC10F92044A3C60003C045 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 33CC10FA2044A3C60003C045 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - }; - name = Release; - }; - 33CC10FC2044A3C60003C045 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - 33CC10FD2044A3C60003C045 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; - 33CC111C2044C6BA0003C045 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Manual; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 33CC111D2044C6BA0003C045 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Automatic; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 331C80DB294CF71000263BE5 /* Debug */, - 331C80DC294CF71000263BE5 /* Release */, - 331C80DD294CF71000263BE5 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 33CC10F92044A3C60003C045 /* Debug */, - 33CC10FA2044A3C60003C045 /* Release */, - 338D0CE9231458BD00FA5F75 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 33CC10FC2044A3C60003C045 /* Debug */, - 33CC10FD2044A3C60003C045 /* Release */, - 338D0CEA231458BD00FA5F75 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 33CC111C2044C6BA0003C045 /* Debug */, - 33CC111D2044C6BA0003C045 /* Release */, - 338D0CEB231458BD00FA5F75 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 33CC10E52044A3C60003C045 /* Project object */; -} diff --git a/mih_ui/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/mih_ui/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/mih_ui/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/mih_ui/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/mih_ui/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme deleted file mode 100644 index 2a240cb9..00000000 --- a/mih_ui/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mih_ui/macos/Runner.xcworkspace/contents.xcworkspacedata b/mih_ui/macos/Runner.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 1d526a16..00000000 --- a/mih_ui/macos/Runner.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/mih_ui/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/mih_ui/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/mih_ui/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/mih_ui/macos/Runner/AppDelegate.swift b/mih_ui/macos/Runner/AppDelegate.swift deleted file mode 100644 index b3c17614..00000000 --- a/mih_ui/macos/Runner/AppDelegate.swift +++ /dev/null @@ -1,13 +0,0 @@ -import Cocoa -import FlutterMacOS - -@main -class AppDelegate: FlutterAppDelegate { - override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { - return true - } - - override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { - return true - } -} diff --git a/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 96d3fee1..00000000 --- a/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "info": { - "version": 1, - "author": "xcode" - }, - "images": [ - { - "size": "16x16", - "idiom": "mac", - "filename": "app_icon_16.png", - "scale": "1x" - }, - { - "size": "16x16", - "idiom": "mac", - "filename": "app_icon_32.png", - "scale": "2x" - }, - { - "size": "32x32", - "idiom": "mac", - "filename": "app_icon_32.png", - "scale": "1x" - }, - { - "size": "32x32", - "idiom": "mac", - "filename": "app_icon_64.png", - "scale": "2x" - }, - { - "size": "128x128", - "idiom": "mac", - "filename": "app_icon_128.png", - "scale": "1x" - }, - { - "size": "128x128", - "idiom": "mac", - "filename": "app_icon_256.png", - "scale": "2x" - }, - { - "size": "256x256", - "idiom": "mac", - "filename": "app_icon_256.png", - "scale": "1x" - }, - { - "size": "256x256", - "idiom": "mac", - "filename": "app_icon_512.png", - "scale": "2x" - }, - { - "size": "512x512", - "idiom": "mac", - "filename": "app_icon_512.png", - "scale": "1x" - }, - { - "size": "512x512", - "idiom": "mac", - "filename": "app_icon_1024.png", - "scale": "2x" - } - ] -} \ No newline at end of file diff --git a/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png deleted file mode 100644 index e7031513..00000000 Binary files a/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png and /dev/null differ diff --git a/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png deleted file mode 100644 index b5cccd9c..00000000 Binary files a/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png and /dev/null differ diff --git a/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png deleted file mode 100644 index 494c06e9..00000000 Binary files a/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png and /dev/null differ diff --git a/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png deleted file mode 100644 index bbcdafc2..00000000 Binary files a/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png and /dev/null differ diff --git a/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png deleted file mode 100644 index c1a99ac2..00000000 Binary files a/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png and /dev/null differ diff --git a/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png deleted file mode 100644 index d6bb6b00..00000000 Binary files a/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png and /dev/null differ diff --git a/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png deleted file mode 100644 index af4ceef0..00000000 Binary files a/mih_ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png and /dev/null differ diff --git a/mih_ui/macos/Runner/Base.lproj/MainMenu.xib b/mih_ui/macos/Runner/Base.lproj/MainMenu.xib deleted file mode 100644 index 80e867a4..00000000 --- a/mih_ui/macos/Runner/Base.lproj/MainMenu.xib +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mih_ui/macos/Runner/Configs/AppInfo.xcconfig b/mih_ui/macos/Runner/Configs/AppInfo.xcconfig deleted file mode 100644 index aa40f4e4..00000000 --- a/mih_ui/macos/Runner/Configs/AppInfo.xcconfig +++ /dev/null @@ -1,14 +0,0 @@ -// Application-level settings for the Runner target. -// -// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the -// future. If not, the values below would default to using the project name when this becomes a -// 'flutter create' template. - -// The application's name. By default this is also the title of the Flutter window. -PRODUCT_NAME = patient_manager - -// The application's bundle identifier -PRODUCT_BUNDLE_IDENTIFIER = com.example.patientManager - -// The copyright displayed in application information -PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. diff --git a/mih_ui/macos/Runner/Configs/Debug.xcconfig b/mih_ui/macos/Runner/Configs/Debug.xcconfig deleted file mode 100644 index 36b0fd94..00000000 --- a/mih_ui/macos/Runner/Configs/Debug.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include "../../Flutter/Flutter-Debug.xcconfig" -#include "Warnings.xcconfig" diff --git a/mih_ui/macos/Runner/Configs/Release.xcconfig b/mih_ui/macos/Runner/Configs/Release.xcconfig deleted file mode 100644 index dff4f495..00000000 --- a/mih_ui/macos/Runner/Configs/Release.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include "../../Flutter/Flutter-Release.xcconfig" -#include "Warnings.xcconfig" diff --git a/mih_ui/macos/Runner/Configs/Warnings.xcconfig b/mih_ui/macos/Runner/Configs/Warnings.xcconfig deleted file mode 100644 index 42bcbf47..00000000 --- a/mih_ui/macos/Runner/Configs/Warnings.xcconfig +++ /dev/null @@ -1,13 +0,0 @@ -WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings -GCC_WARN_UNDECLARED_SELECTOR = YES -CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES -CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE -CLANG_WARN__DUPLICATE_METHOD_MATCH = YES -CLANG_WARN_PRAGMA_PACK = YES -CLANG_WARN_STRICT_PROTOTYPES = YES -CLANG_WARN_COMMA = YES -GCC_WARN_STRICT_SELECTOR_MATCH = YES -CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES -CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES -GCC_WARN_SHADOW = YES -CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/mih_ui/macos/Runner/DebugProfile.entitlements b/mih_ui/macos/Runner/DebugProfile.entitlements deleted file mode 100644 index dddb8a30..00000000 --- a/mih_ui/macos/Runner/DebugProfile.entitlements +++ /dev/null @@ -1,12 +0,0 @@ - - - - - com.apple.security.app-sandbox - - com.apple.security.cs.allow-jit - - com.apple.security.network.server - - - diff --git a/mih_ui/macos/Runner/GoogleService-Info.plist b/mih_ui/macos/Runner/GoogleService-Info.plist deleted file mode 100644 index 380f61da..00000000 --- a/mih_ui/macos/Runner/GoogleService-Info.plist +++ /dev/null @@ -1,30 +0,0 @@ - - - - - API_KEY - AIzaSyDRqY5I5CXjEtWkUX1YUfKT8IUlln9PUuY - GCM_SENDER_ID - 33677883408 - PLIST_VERSION - 1 - BUNDLE_ID - com.example.patientManager - PROJECT_ID - mzansi-innovation-hub - STORAGE_BUCKET - mzansi-innovation-hub.firebasestorage.app - IS_ADS_ENABLED - - IS_ANALYTICS_ENABLED - - IS_APPINVITE_ENABLED - - IS_GCM_ENABLED - - IS_SIGNIN_ENABLED - - GOOGLE_APP_ID - 1:33677883408:ios:e2db11a42fc3452e223295 - - \ No newline at end of file diff --git a/mih_ui/macos/Runner/Info.plist b/mih_ui/macos/Runner/Info.plist deleted file mode 100644 index 4789daa6..00000000 --- a/mih_ui/macos/Runner/Info.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIconFile - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSMinimumSystemVersion - $(MACOSX_DEPLOYMENT_TARGET) - NSHumanReadableCopyright - $(PRODUCT_COPYRIGHT) - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/mih_ui/macos/Runner/MainFlutterWindow.swift b/mih_ui/macos/Runner/MainFlutterWindow.swift deleted file mode 100644 index 3cc05eb2..00000000 --- a/mih_ui/macos/Runner/MainFlutterWindow.swift +++ /dev/null @@ -1,15 +0,0 @@ -import Cocoa -import FlutterMacOS - -class MainFlutterWindow: NSWindow { - override func awakeFromNib() { - let flutterViewController = FlutterViewController() - let windowFrame = self.frame - self.contentViewController = flutterViewController - self.setFrame(windowFrame, display: true) - - RegisterGeneratedPlugins(registry: flutterViewController) - - super.awakeFromNib() - } -} diff --git a/mih_ui/macos/Runner/Release.entitlements b/mih_ui/macos/Runner/Release.entitlements deleted file mode 100644 index 852fa1a4..00000000 --- a/mih_ui/macos/Runner/Release.entitlements +++ /dev/null @@ -1,8 +0,0 @@ - - - - - com.apple.security.app-sandbox - - - diff --git a/mih_ui/macos/RunnerTests/RunnerTests.swift b/mih_ui/macos/RunnerTests/RunnerTests.swift deleted file mode 100644 index 5418c9f5..00000000 --- a/mih_ui/macos/RunnerTests/RunnerTests.swift +++ /dev/null @@ -1,12 +0,0 @@ -import FlutterMacOS -import Cocoa -import XCTest - -class RunnerTests: XCTestCase { - - func testExample() { - // If you add code to the Runner application, consider adding tests here. - // See https://developer.apple.com/documentation/xctest for more information about using XCTest. - } - -} diff --git a/mih_ui/mih_app_flatpak/main.png b/mih_ui/mih_app_flatpak/main.png deleted file mode 100644 index 0932dbc3..00000000 Binary files a/mih_ui/mih_app_flatpak/main.png and /dev/null differ diff --git a/mih_ui/mih_app_flatpak/za.co.mzansiinnovationhub.mih.desktop b/mih_ui/mih_app_flatpak/za.co.mzansiinnovationhub.mih.desktop deleted file mode 100644 index af77e0f8..00000000 --- a/mih_ui/mih_app_flatpak/za.co.mzansiinnovationhub.mih.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Version=1.0 -Type=Application -Name=MIH -GenericName=Mzansi Innovation Hub -Comment=Mzansi Innovation Hub official application -Exec=mzansi_innovation_hub -Icon=za.co.mzansiinnovationhub.mih -Terminal=false -Categories=Utility; -Keywords=MIH;Mzansi;Innovation;Hub; -StartupWMClass=mzansi_innovation_hub \ No newline at end of file diff --git a/mih_ui/mih_app_flatpak/za.co.mzansiinnovationhub.mih.metainfo.xml b/mih_ui/mih_app_flatpak/za.co.mzansiinnovationhub.mih.metainfo.xml deleted file mode 100644 index 1e3a0bd2..00000000 --- a/mih_ui/mih_app_flatpak/za.co.mzansiinnovationhub.mih.metainfo.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - za.co.mzansiinnovationhub.mih - - MIH - Innovation tools and services for the Mzansi ecosystem - - CC0-1.0 - GPL-3.0 - Mzansi Innovation Hub - - -

- MIH (Mzansi Innovation Hub) is a modern desktop application designed to provide - innovation tools and services for users. Built with Flutter, it offers a - high-performance, responsive interface tailored for the Linux desktop. -

-
    -
  • Access professional innovation resources
  • -
  • Streamlined user interface for efficiency
  • -
  • Native integration with Linux desktop environments
  • -
-
- - za.co.mzansiinnovationhub.mih.desktop - - - - The main dashboard of the MIH application. - https://git.mzansi-innovation-hub.co.za/yaso_meth/mih-project/raw/main/screenshots/main.png - - - - https://mzansi-innovation-hub.co.za/ - https://git.mzansi-innovation-hub.co.za/yaso_meth/mih-project/issues - - - mzansi_innovation_hub - - - - - - - - - - Utility - - -
\ No newline at end of file diff --git a/mih_ui/mih_app_flatpak/za.co.mzansiinnovationhub.mih.png b/mih_ui/mih_app_flatpak/za.co.mzansiinnovationhub.mih.png deleted file mode 100644 index 4153a949..00000000 Binary files a/mih_ui/mih_app_flatpak/za.co.mzansiinnovationhub.mih.png and /dev/null differ diff --git a/mih_ui/mih_app_flatpak/za.co.mzansiinnovationhub.mih.yml b/mih_ui/mih_app_flatpak/za.co.mzansiinnovationhub.mih.yml deleted file mode 100644 index 0d681e07..00000000 --- a/mih_ui/mih_app_flatpak/za.co.mzansiinnovationhub.mih.yml +++ /dev/null @@ -1,55 +0,0 @@ -id: za.co.mzansiinnovationhub.mih -runtime: org.freedesktop.Platform -runtime-version: '24.08' -sdk: org.freedesktop.Sdk -command: mzansi_innovation_hub - -finish-args: - - --share=ipc - - --share=network # Added for Internet access - - --socket=fallback-x11 - - --socket=wayland - - --device=dri - # Removed --filesystem=home for better security; add back only if strictly needed. - -modules: - - name: mzansi-innovation-hub - buildsystem: simple - sources: - - type: archive - url: https://git.mzansi-innovation-hub.co.za/yaso_meth/mih-project/releases/download/linux/mzansi_innovation_hub.tar.gz - sha256: b8c383f4d43e2de36b4e6520c9745e3f8e8618bdb9ef6024ad0bf260061137a9 - # If the tarball contains a top-level folder (like 'bundle'), - # flatpak-builder enters it automatically. - # If it doesn't, we use the commands below to find them. - - - type: file - path: za.co.mzansiinnovationhub.mih.desktop - - type: file - path: za.co.mzansiinnovationhub.mih.metainfo.xml - - type: file - path: za.co.mzansiinnovationhub.mih.png - - build-commands: - # 1. Create the necessary directories - - mkdir -p /app/bin /app/share/applications /app/share/icons/hicolor/256x256/apps /app/share/metainfo - - # 2. Move EVERYTHING from your archive into /app/bin/ - # We use 'find' to move only the app-related files and avoid the metadata files - - | - find . -mindepth 1 -maxdepth 2 \ - ! -name "*.desktop" \ - ! -name "*.xml" \ - ! -name "*.png" \ - ! -name "*.yml" \ - -exec cp -R -t /app/bin/ {} + - - # 3. Ensure the binary is in the right place and executable - # If the binary ended up in a subfolder, this moves it to the top of /app/bin - - find /app/bin -name "mzansi_innovation_hub" -type f -exec mv {} /app/bin/ \; - - chmod +x /app/bin/mzansi_innovation_hub - - # 4. Install Metadata (using the exact local files) - - install -Dm644 za.co.mzansiinnovationhub.mih.desktop /app/share/applications/za.co.mzansiinnovationhub.mih.desktop - - install -Dm644 za.co.mzansiinnovationhub.mih.png /app/share/icons/hicolor/256x256/apps/za.co.mzansiinnovationhub.mih.png - - install -Dm644 za.co.mzansiinnovationhub.mih.metainfo.xml /app/share/metainfo/za.co.mzansiinnovationhub.mih.metainfo.xml \ No newline at end of file diff --git a/mih_ui/pubspec.lock b/mih_ui/pubspec.lock deleted file mode 100644 index a253f2b4..00000000 --- a/mih_ui/pubspec.lock +++ /dev/null @@ -1,2290 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - sha256: e55636ed79578b9abca5fecf9437947798f5ef7456308b5cb85720b793eac92f - url: "https://pub.dev" - source: hosted - version: "82.0.0" - _flutterfire_internals: - dependency: transitive - description: - name: _flutterfire_internals - sha256: "8a1f5f3020ef2a74fb93f7ab3ef127a8feea33a7a2276279113660784ee7516a" - url: "https://pub.dev" - source: hosted - version: "1.3.64" - analyzer: - dependency: transitive - description: - name: analyzer - sha256: "904ae5bb474d32c38fb9482e2d925d5454cda04ddd0e55d2e6826bc72f6ba8c0" - url: "https://pub.dev" - source: hosted - version: "7.4.5" - ansicolor: - dependency: transitive - description: - name: ansicolor - sha256: "50e982d500bc863e1d703448afdbf9e5a72eb48840a4f766fa361ffd6877055f" - url: "https://pub.dev" - source: hosted - version: "2.0.3" - app_settings: - dependency: "direct main" - description: - name: app_settings - sha256: "3e46c561441e5820d3a25339bf8b51b9e45a5f686873851a20c257a530917795" - url: "https://pub.dev" - source: hosted - version: "6.1.1" - archive: - dependency: transitive - description: - name: archive - sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd" - url: "https://pub.dev" - source: hosted - version: "4.0.7" - args: - dependency: "direct main" - description: - name: args - sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 - url: "https://pub.dev" - source: hosted - version: "2.7.0" - async: - dependency: transitive - description: - name: async - sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" - url: "https://pub.dev" - source: hosted - version: "2.13.0" - barcode: - dependency: transitive - description: - name: barcode - sha256: "7b6729c37e3b7f34233e2318d866e8c48ddb46c1f7ad01ff7bb2a8de1da2b9f4" - url: "https://pub.dev" - source: hosted - version: "2.2.9" - barcode_widget: - dependency: "direct main" - description: - name: barcode_widget - sha256: "6f2c5b08659b1a5f4d88d183e6007133ea2f96e50e7b8bb628f03266c3931427" - url: "https://pub.dev" - source: hosted - version: "2.0.4" - bazel_worker: - dependency: transitive - description: - name: bazel_worker - sha256: "373a6ef07caa6c674c1cf144a5fe1e0f712c040552031ce669f298e35f7e110a" - url: "https://pub.dev" - source: hosted - version: "1.1.3" - bidi: - dependency: transitive - description: - name: bidi - sha256: "77f475165e94b261745cf1032c751e2032b8ed92ccb2bf5716036db79320637d" - url: "https://pub.dev" - source: hosted - version: "2.0.13" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - build: - dependency: transitive - description: - name: build - sha256: cef23f1eda9b57566c81e2133d196f8e3df48f244b317368d65c5943d91148f0 - url: "https://pub.dev" - source: hosted - version: "2.4.2" - build_config: - dependency: transitive - description: - name: build_config - sha256: "4ae2de3e1e67ea270081eaee972e1bd8f027d459f249e0f1186730784c2e7e33" - url: "https://pub.dev" - source: hosted - version: "1.1.2" - build_daemon: - dependency: transitive - description: - name: build_daemon - sha256: "8e928697a82be082206edb0b9c99c5a4ad6bc31c9e9b8b2f291ae65cd4a25daa" - url: "https://pub.dev" - source: hosted - version: "4.0.4" - build_modules: - dependency: transitive - description: - name: build_modules - sha256: b1fc29a603669b25a5d95cc9610ed649e9f00e6075e5b6b721aa1a095cff13de - url: "https://pub.dev" - source: hosted - version: "5.0.13" - build_resolvers: - dependency: transitive - description: - name: build_resolvers - sha256: b9e4fda21d846e192628e7a4f6deda6888c36b5b69ba02ff291a01fd529140f0 - url: "https://pub.dev" - source: hosted - version: "2.4.4" - build_runner: - dependency: "direct dev" - description: - name: build_runner - sha256: "058fe9dce1de7d69c4b84fada934df3e0153dd000758c4d65964d0166779aa99" - url: "https://pub.dev" - source: hosted - version: "2.4.15" - build_runner_core: - dependency: transitive - description: - name: build_runner_core - sha256: "22e3aa1c80e0ada3722fe5b63fd43d9c8990759d0a2cf489c8c5d7b2bdebc021" - url: "https://pub.dev" - source: hosted - version: "8.0.0" - build_web_compilers: - dependency: "direct dev" - description: - name: build_web_compilers - sha256: f9b8e84dbfa7688221c2376e6f68ffd796597785a0a5b1e8cd2516a92fdc0a3c - url: "https://pub.dev" - source: hosted - version: "4.1.5" - built_collection: - dependency: transitive - description: - name: built_collection - sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" - url: "https://pub.dev" - source: hosted - version: "5.1.1" - built_value: - dependency: transitive - description: - name: built_value - sha256: "082001b5c3dc495d4a42f1d5789990505df20d8547d42507c29050af6933ee27" - url: "https://pub.dev" - source: hosted - version: "8.10.1" - cached_network_image: - dependency: "direct main" - description: - name: cached_network_image - sha256: "7c1183e361e5c8b0a0f21a28401eecdbde252441106a9816400dd4c2b2424916" - url: "https://pub.dev" - source: hosted - version: "3.4.1" - cached_network_image_platform_interface: - dependency: transitive - description: - name: cached_network_image_platform_interface - sha256: "35814b016e37fbdc91f7ae18c8caf49ba5c88501813f73ce8a07027a395e2829" - url: "https://pub.dev" - source: hosted - version: "4.1.1" - cached_network_image_web: - dependency: transitive - description: - name: cached_network_image_web - sha256: "980842f4e8e2535b8dbd3d5ca0b1f0ba66bf61d14cc3a17a9b4788a3685ba062" - url: "https://pub.dev" - source: hosted - version: "1.3.1" - camera: - dependency: transitive - description: - name: camera - sha256: "87a27e0553e3432119c1c2f6e4b9a1bbf7d2c660552b910bfa59185a9facd632" - url: "https://pub.dev" - source: hosted - version: "0.11.2+1" - camera_android_camerax: - dependency: transitive - description: - name: camera_android_camerax - sha256: "58b8fe843a3c83fd1273c00cb35f5a8ae507f6cc9b2029bcf7e2abba499e28d8" - url: "https://pub.dev" - source: hosted - version: "0.6.19+1" - camera_avfoundation: - dependency: transitive - description: - name: camera_avfoundation - sha256: "951ef122d01ebba68b7a54bfe294e8b25585635a90465c311b2f875ae72c412f" - url: "https://pub.dev" - source: hosted - version: "0.9.21+2" - camera_platform_interface: - dependency: transitive - description: - name: camera_platform_interface - sha256: "98cfc9357e04bad617671b4c1f78a597f25f08003089dd94050709ae54effc63" - url: "https://pub.dev" - source: hosted - version: "2.12.0" - camera_web: - dependency: transitive - description: - name: camera_web - sha256: "595f28c89d1fb62d77c73c633193755b781c6d2e0ebcd8dc25b763b514e6ba8f" - url: "https://pub.dev" - source: hosted - version: "0.3.5" - characters: - dependency: transitive - description: - name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 - url: "https://pub.dev" - source: hosted - version: "1.4.0" - charcode: - dependency: transitive - description: - name: charcode - sha256: fb0f1107cac15a5ea6ef0a6ef71a807b9e4267c713bb93e00e92d737cc8dbd8a - url: "https://pub.dev" - source: hosted - version: "1.4.0" - checked_yaml: - dependency: transitive - description: - name: checked_yaml - sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" - url: "https://pub.dev" - source: hosted - version: "2.0.4" - cli_util: - dependency: transitive - description: - name: cli_util - sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c - url: "https://pub.dev" - source: hosted - version: "0.4.2" - clock: - dependency: transitive - description: - name: clock - sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b - url: "https://pub.dev" - source: hosted - version: "1.1.2" - code_builder: - dependency: transitive - description: - name: code_builder - sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e" - url: "https://pub.dev" - source: hosted - version: "4.10.1" - collection: - dependency: transitive - description: - name: collection - sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" - url: "https://pub.dev" - source: hosted - version: "1.19.1" - convert: - dependency: transitive - description: - name: convert - sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 - url: "https://pub.dev" - source: hosted - version: "3.1.2" - country_code_picker: - dependency: "direct main" - description: - name: country_code_picker - sha256: ee216486da1db8e3c5688f9650c99472ab6a4025ed1ea0c5a54ae6063143d90d - url: "https://pub.dev" - source: hosted - version: "3.3.0" - cross_file: - dependency: "direct main" - description: - name: cross_file - sha256: "701dcfc06da0882883a2657c445103380e53e647060ad8d9dfb710c100996608" - url: "https://pub.dev" - source: hosted - version: "0.3.5+1" - crypto: - dependency: transitive - description: - name: crypto - sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" - url: "https://pub.dev" - source: hosted - version: "3.0.6" - csslib: - dependency: transitive - description: - name: csslib - sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" - url: "https://pub.dev" - source: hosted - version: "1.0.2" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.dev" - source: hosted - version: "1.0.8" - custom_rating_bar: - dependency: "direct main" - description: - name: custom_rating_bar - sha256: c2dafa488843b29f50ac2c2905b6a4cefd2cb603de31c6224adb047b6ed8593e - url: "https://pub.dev" - source: hosted - version: "3.0.0" - dart_style: - dependency: transitive - description: - name: dart_style - sha256: "5b236382b47ee411741447c1f1e111459c941ea1b3f2b540dde54c210a3662af" - url: "https://pub.dev" - source: hosted - version: "3.1.0" - dbus: - dependency: transitive - description: - name: dbus - sha256: d0c98dcd4f5169878b6cf8f6e0a52403a9dff371a3e2f019697accbf6f44a270 - url: "https://pub.dev" - source: hosted - version: "0.7.12" - device_info_plus: - dependency: transitive - description: - name: device_info_plus - sha256: "0c6396126421b590089447154c5f98a5de423b70cfb15b1578fd018843ee6f53" - url: "https://pub.dev" - source: hosted - version: "11.4.0" - device_info_plus_platform_interface: - dependency: transitive - description: - name: device_info_plus_platform_interface - sha256: "0b04e02b30791224b31969eb1b50d723498f402971bff3630bca2ba839bd1ed2" - url: "https://pub.dev" - source: hosted - version: "7.0.2" - diacritic: - dependency: transitive - description: - name: diacritic - sha256: "12981945ec38931748836cd76f2b38773118d0baef3c68404bdfde9566147876" - url: "https://pub.dev" - source: hosted - version: "0.1.6" - diffutil_dart: - dependency: transitive - description: - name: diffutil_dart - sha256: "5e74883aedf87f3b703cb85e815bdc1ed9208b33501556e4a8a5572af9845c81" - url: "https://pub.dev" - source: hosted - version: "4.0.1" - dio: - dependency: transitive - description: - name: dio - sha256: "253a18bbd4851fecba42f7343a1df3a9a4c1d31a2c1b37e221086b4fa8c8dbc9" - url: "https://pub.dev" - source: hosted - version: "5.8.0+1" - dio_web_adapter: - dependency: transitive - description: - name: dio_web_adapter - sha256: "7586e476d70caecaf1686d21eee7247ea43ef5c345eab9e0cc3583ff13378d78" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - equatable: - dependency: transitive - description: - name: equatable - sha256: "567c64b3cb4cf82397aac55f4f0cbd3ca20d77c6c03bedbc4ceaddc08904aef7" - url: "https://pub.dev" - source: hosted - version: "2.0.7" - fake_async: - dependency: transitive - description: - name: fake_async - sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" - url: "https://pub.dev" - source: hosted - version: "1.3.3" - ffi: - dependency: transitive - description: - name: ffi - sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - file: - dependency: transitive - description: - name: file - sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 - url: "https://pub.dev" - source: hosted - version: "7.0.1" - file_picker: - dependency: "direct main" - description: - name: file_picker - sha256: "77f8e81d22d2a07d0dee2c62e1dda71dc1da73bf43bb2d45af09727406167964" - url: "https://pub.dev" - source: hosted - version: "10.1.9" - file_saver: - dependency: "direct main" - description: - name: file_saver - sha256: "9d93db09bd4da9e43238f9dd485360fc51a5c138eea5ef5f407ec56e58079ac0" - url: "https://pub.dev" - source: hosted - version: "0.3.1" - file_selector: - dependency: transitive - description: - name: file_selector - sha256: "5f1d15a7f17115038f433d1b0ea57513cc9e29a9d5338d166cb0bef3fa90a7a0" - url: "https://pub.dev" - source: hosted - version: "1.0.4" - file_selector_android: - dependency: transitive - description: - name: file_selector_android - sha256: "1ce58b609289551f8ec07265476720e77d19764339cc1d8e4df3c4d34dac6499" - url: "https://pub.dev" - source: hosted - version: "0.5.1+17" - file_selector_ios: - dependency: transitive - description: - name: file_selector_ios - sha256: fe9f52123af16bba4ad65bd7e03defbbb4b172a38a8e6aaa2a869a0c56a5f5fb - url: "https://pub.dev" - source: hosted - version: "0.5.3+2" - file_selector_linux: - dependency: transitive - description: - name: file_selector_linux - sha256: "54cbbd957e1156d29548c7d9b9ec0c0ebb6de0a90452198683a7d23aed617a33" - url: "https://pub.dev" - source: hosted - version: "0.9.3+2" - file_selector_macos: - dependency: transitive - description: - name: file_selector_macos - sha256: "19124ff4a3d8864fdc62072b6a2ef6c222d55a3404fe14893a3c02744907b60c" - url: "https://pub.dev" - source: hosted - version: "0.9.4+4" - file_selector_platform_interface: - dependency: transitive - description: - name: file_selector_platform_interface - sha256: a3994c26f10378a039faa11de174d7b78eb8f79e4dd0af2a451410c1a5c3f66b - url: "https://pub.dev" - source: hosted - version: "2.6.2" - file_selector_web: - dependency: transitive - description: - name: file_selector_web - sha256: c4c0ea4224d97a60a7067eca0c8fd419e708ff830e0c83b11a48faf566cec3e7 - url: "https://pub.dev" - source: hosted - version: "0.9.4+2" - file_selector_windows: - dependency: transitive - description: - name: file_selector_windows - sha256: "320fcfb6f33caa90f0b58380489fc5ac05d99ee94b61aa96ec2bff0ba81d3c2b" - url: "https://pub.dev" - source: hosted - version: "0.9.3+4" - firebase_ai: - dependency: transitive - description: - name: firebase_ai - sha256: "6bffa52bc4b9557b73f59de12ec36349bde76f772431d0702c7ecb4bfeeeb21b" - url: "https://pub.dev" - source: hosted - version: "3.5.0" - firebase_app_check: - dependency: transitive - description: - name: firebase_app_check - sha256: "4d00b502f510ee97cdb395e95a31a8b871fc96cb917ffc60591528d3c9735986" - url: "https://pub.dev" - source: hosted - version: "0.4.1+2" - firebase_app_check_platform_interface: - dependency: transitive - description: - name: firebase_app_check_platform_interface - sha256: "7d104d01b00e5dec367dc79184ad99bd1941f2d839b5ef41156b2330c18af13f" - url: "https://pub.dev" - source: hosted - version: "0.2.1+2" - firebase_app_check_web: - dependency: transitive - description: - name: firebase_app_check_web - sha256: "885a1a7b8e33c52afaf9c5d75eca616ae310d6ea90322e9a462f8c154ad16b64" - url: "https://pub.dev" - source: hosted - version: "0.2.2" - firebase_auth: - dependency: transitive - description: - name: firebase_auth - sha256: e54fb3ba57de041d832574126a37726eedf0f57400869f1942b0ca8ce4a6e209 - url: "https://pub.dev" - source: hosted - version: "6.1.2" - firebase_auth_platform_interface: - dependency: transitive - description: - name: firebase_auth_platform_interface - sha256: "421f95dc553cb283ed9d4d140e719800c0331d49ed37b962e513c9d1d61b090b" - url: "https://pub.dev" - source: hosted - version: "8.1.4" - firebase_auth_web: - dependency: transitive - description: - name: firebase_auth_web - sha256: a064ffee202f7d42d62e2c01775899d4ffcb83c602af07632f206acd46a0964e - url: "https://pub.dev" - source: hosted - version: "6.1.0" - firebase_core: - dependency: transitive - description: - name: firebase_core - sha256: "923085c881663ef685269b013e241b428e1fb03cdd0ebde265d9b40ff18abf80" - url: "https://pub.dev" - source: hosted - version: "4.4.0" - firebase_core_platform_interface: - dependency: transitive - description: - name: firebase_core_platform_interface - sha256: cccb4f572325dc14904c02fcc7db6323ad62ba02536833dddb5c02cac7341c64 - url: "https://pub.dev" - source: hosted - version: "6.0.2" - firebase_core_web: - dependency: transitive - description: - name: firebase_core_web - sha256: "83e7356c704131ca4d8d8dd57e360d8acecbca38b1a3705c7ae46cc34c708084" - url: "https://pub.dev" - source: hosted - version: "3.4.0" - fixnum: - dependency: transitive - description: - name: fixnum - sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be - url: "https://pub.dev" - source: hosted - version: "1.1.1" - fl_downloader: - dependency: "direct main" - description: - name: fl_downloader - sha256: e3f0696f7b22933baeae3c99d806c3a6f11507ab6c2bf74b4c580abf8e036f80 - url: "https://pub.dev" - source: hosted - version: "2.0.2" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_ai_toolkit: - dependency: "direct main" - description: - name: flutter_ai_toolkit - sha256: b653814f9aac05d84f15db0daf1bf90e9bd9177abeba378c6f1d4a75bb2099a5 - url: "https://pub.dev" - source: hosted - version: "0.10.0" - flutter_cache_manager: - dependency: transitive - description: - name: flutter_cache_manager - sha256: "400b6592f16a4409a7f2bb929a9a7e38c72cceb8ffb99ee57bbf2cb2cecf8386" - url: "https://pub.dev" - source: hosted - version: "3.4.1" - flutter_chat_types: - dependency: "direct main" - description: - name: flutter_chat_types - sha256: e285b588f6d19d907feb1f6d912deaf22e223656769c34093b64e1c59b094fb9 - url: "https://pub.dev" - source: hosted - version: "3.6.2" - flutter_chat_ui: - dependency: "direct main" - description: - name: flutter_chat_ui - sha256: "168a4231464ad00a17ea5f0813f1b58393bdd4035683ea4dc37bbe26be62891e" - url: "https://pub.dev" - source: hosted - version: "1.6.15" - flutter_context_menu: - dependency: transitive - description: - name: flutter_context_menu - sha256: "79fe00cd7e3ac3840a552cb3e653d8eb61d827b6c04c559e219973a1dc769165" - url: "https://pub.dev" - source: hosted - version: "0.3.0" - flutter_dotenv: - dependency: "direct main" - description: - name: flutter_dotenv - sha256: d4130c4a43e0b13fefc593bc3961f2cb46e30cb79e253d4a526b1b5d24ae1ce4 - url: "https://pub.dev" - source: hosted - version: "6.0.0" - flutter_launcher_icons: - dependency: "direct main" - description: - name: flutter_launcher_icons - sha256: "10f13781741a2e3972126fae08393d3c4e01fa4cd7473326b94b72cf594195e7" - url: "https://pub.dev" - source: hosted - version: "0.14.4" - flutter_link_previewer: - dependency: transitive - description: - name: flutter_link_previewer - sha256: "007069e60f42419fb59872beb7a3cc3ea21e9f1bdff5d40239f376fa62ca9f20" - url: "https://pub.dev" - source: hosted - version: "3.2.2" - flutter_linkify: - dependency: transitive - description: - name: flutter_linkify - sha256: "74669e06a8f358fee4512b4320c0b80e51cffc496607931de68d28f099254073" - url: "https://pub.dev" - source: hosted - version: "6.0.0" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" - url: "https://pub.dev" - source: hosted - version: "6.0.0" - flutter_markdown_plus: - dependency: "direct main" - description: - name: flutter_markdown_plus - sha256: "7f349c075157816da399216a4127096108fd08e1ac931e34e72899281db4113c" - url: "https://pub.dev" - source: hosted - version: "1.0.5" - flutter_native_splash: - dependency: "direct main" - description: - name: flutter_native_splash - sha256: "8321a6d11a8d13977fa780c89de8d257cce3d841eecfb7a4cadffcc4f12d82dc" - url: "https://pub.dev" - source: hosted - version: "2.4.6" - flutter_parsed_text: - dependency: transitive - description: - name: flutter_parsed_text - sha256: "529cf5793b7acdf16ee0f97b158d0d4ba0bf06e7121ef180abe1a5b59e32c1e2" - url: "https://pub.dev" - source: hosted - version: "2.2.1" - flutter_picture_taker: - dependency: transitive - description: - name: flutter_picture_taker - sha256: d24d4c10e42324832b550bd59d1fe84129e860b75b4b2d57d6b398a41fd5dc9a - url: "https://pub.dev" - source: hosted - version: "0.2.0" - flutter_plugin_android_lifecycle: - dependency: transitive - description: - name: flutter_plugin_android_lifecycle - sha256: f948e346c12f8d5480d2825e03de228d0eb8c3a737e4cdaa122267b89c022b5e - url: "https://pub.dev" - source: hosted - version: "2.0.28" - flutter_speed_dial: - dependency: "direct main" - description: - name: flutter_speed_dial - sha256: "698a037274a66dbae8697c265440e6acb6ab6cae9ac5f95c749e7944d8f28d41" - url: "https://pub.dev" - source: hosted - version: "7.0.0" - flutter_svg: - dependency: transitive - description: - name: flutter_svg - sha256: cd57f7969b4679317c17af6fd16ee233c1e60a82ed209d8a475c54fd6fd6f845 - url: "https://pub.dev" - source: hosted - version: "2.2.0" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - flutter_tts: - dependency: "direct main" - description: - name: flutter_tts - sha256: bdf2fc4483e74450dc9fc6fe6a9b6a5663e108d4d0dad3324a22c8e26bf48af4 - url: "https://pub.dev" - source: hosted - version: "4.2.3" - flutter_web_plugins: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - font_awesome_flutter: - dependency: "direct main" - description: - name: font_awesome_flutter - sha256: d3a89184101baec7f4600d58840a764d2ef760fe1c5a20ef9e6b0e9b24a07a3a - url: "https://pub.dev" - source: hosted - version: "10.8.0" - freezed_annotation: - dependency: transitive - description: - name: freezed_annotation - sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8" - url: "https://pub.dev" - source: hosted - version: "3.1.0" - frontend_server_client: - dependency: transitive - description: - name: frontend_server_client - sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 - url: "https://pub.dev" - source: hosted - version: "4.0.0" - geoclue: - dependency: transitive - description: - name: geoclue - sha256: c2a998c77474fc57aa00c6baa2928e58f4b267649057a1c76738656e9dbd2a7f - url: "https://pub.dev" - source: hosted - version: "0.1.1" - geolocator: - dependency: "direct main" - description: - name: geolocator - sha256: ee2212a3df8292ec4c90b91183b8001d3f5a800823c974b570c5f9344ca320dc - url: "https://pub.dev" - source: hosted - version: "14.0.1" - geolocator_android: - dependency: transitive - description: - name: geolocator_android - sha256: "114072db5d1dce0ec0b36af2697f55c133bc89a2c8dd513e137c0afe59696ed4" - url: "https://pub.dev" - source: hosted - version: "5.0.1+1" - geolocator_apple: - dependency: transitive - description: - name: geolocator_apple - sha256: dbdd8789d5aaf14cf69f74d4925ad1336b4433a6efdf2fce91e8955dc921bf22 - url: "https://pub.dev" - source: hosted - version: "2.3.13" - geolocator_linux: - dependency: "direct main" - description: - name: geolocator_linux - sha256: d64112a205931926f4363bb6bd48f14cb38e7326833041d170615586cd143797 - url: "https://pub.dev" - source: hosted - version: "0.2.4" - geolocator_platform_interface: - dependency: transitive - description: - name: geolocator_platform_interface - sha256: "30cb64f0b9adcc0fb36f628b4ebf4f731a2961a0ebd849f4b56200205056fe67" - url: "https://pub.dev" - source: hosted - version: "4.2.6" - geolocator_web: - dependency: transitive - description: - name: geolocator_web - sha256: b1ae9bdfd90f861fde8fd4f209c37b953d65e92823cb73c7dee1fa021b06f172 - url: "https://pub.dev" - source: hosted - version: "4.1.3" - geolocator_windows: - dependency: transitive - description: - name: geolocator_windows - sha256: "175435404d20278ffd220de83c2ca293b73db95eafbdc8131fe8609be1421eb6" - url: "https://pub.dev" - source: hosted - version: "0.2.5" - glob: - dependency: transitive - description: - name: glob - sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de - url: "https://pub.dev" - source: hosted - version: "2.1.3" - gma_mediation_meta: - dependency: "direct main" - description: - name: gma_mediation_meta - sha256: "8c9448d194faf85dbd7e09e4cd602192018915b2803b1605af01549fb72088b3" - url: "https://pub.dev" - source: hosted - version: "1.4.1" - go_router: - dependency: "direct main" - description: - name: go_router - sha256: "8b1f37dfaf6e958c6b872322db06f946509433bec3de753c3491a42ae9ec2b48" - url: "https://pub.dev" - source: hosted - version: "16.1.0" - google_fonts: - dependency: transitive - description: - name: google_fonts - sha256: "517b20870220c48752eafa0ba1a797a092fb22df0d89535fd9991e86ee2cdd9c" - url: "https://pub.dev" - source: hosted - version: "6.3.2" - google_mobile_ads: - dependency: "direct main" - description: - name: google_mobile_ads - sha256: a4f59019f2c32769fb6c60ed8aa321e9c21a36297e2c4f23452b3e779a3e7a26 - url: "https://pub.dev" - source: hosted - version: "6.0.0" - graphs: - dependency: transitive - description: - name: graphs - sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" - url: "https://pub.dev" - source: hosted - version: "2.3.2" - gsettings: - dependency: transitive - description: - name: gsettings - sha256: "1b0ce661f5436d2db1e51f3c4295a49849f03d304003a7ba177d01e3a858249c" - url: "https://pub.dev" - source: hosted - version: "0.2.8" - html: - dependency: transitive - description: - name: html - sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602" - url: "https://pub.dev" - source: hosted - version: "0.15.6" - http: - dependency: "direct main" - description: - name: http - sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b" - url: "https://pub.dev" - source: hosted - version: "1.4.0" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 - url: "https://pub.dev" - source: hosted - version: "3.2.2" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" - url: "https://pub.dev" - source: hosted - version: "4.1.2" - image: - dependency: transitive - description: - name: image - sha256: "4e973fcf4caae1a4be2fa0a13157aa38a8f9cb049db6529aa00b4d71abc4d928" - url: "https://pub.dev" - source: hosted - version: "4.5.4" - image_picker: - dependency: transitive - description: - name: image_picker - sha256: "736eb56a911cf24d1859315ad09ddec0b66104bc41a7f8c5b96b4e2620cf5041" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - image_picker_android: - dependency: transitive - description: - name: image_picker_android - sha256: "28f3987ca0ec702d346eae1d90eda59603a2101b52f1e234ded62cff1d5cfa6e" - url: "https://pub.dev" - source: hosted - version: "0.8.13+1" - image_picker_for_web: - dependency: transitive - description: - name: image_picker_for_web - sha256: "40c2a6a0da15556dc0f8e38a3246064a971a9f512386c3339b89f76db87269b6" - url: "https://pub.dev" - source: hosted - version: "3.1.0" - image_picker_ios: - dependency: transitive - description: - name: image_picker_ios - sha256: eb06fe30bab4c4497bad449b66448f50edcc695f1c59408e78aa3a8059eb8f0e - url: "https://pub.dev" - source: hosted - version: "0.8.13" - image_picker_linux: - dependency: transitive - description: - name: image_picker_linux - sha256: "1f81c5f2046b9ab724f85523e4af65be1d47b038160a8c8deed909762c308ed4" - url: "https://pub.dev" - source: hosted - version: "0.2.2" - image_picker_macos: - dependency: transitive - description: - name: image_picker_macos - sha256: d58cd9d67793d52beefd6585b12050af0a7663c0c2a6ece0fb110a35d6955e04 - url: "https://pub.dev" - source: hosted - version: "0.2.2" - image_picker_platform_interface: - dependency: transitive - description: - name: image_picker_platform_interface - sha256: "567e056716333a1647c64bb6bd873cff7622233a5c3f694be28a583d4715690c" - url: "https://pub.dev" - source: hosted - version: "2.11.1" - image_picker_windows: - dependency: transitive - description: - name: image_picker_windows - sha256: d248c86554a72b5495a31c56f060cf73a41c7ff541689327b1a7dbccc33adfae - url: "https://pub.dev" - source: hosted - version: "0.2.2" - intl: - dependency: "direct main" - description: - name: intl - sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" - url: "https://pub.dev" - source: hosted - version: "0.20.2" - io: - dependency: transitive - description: - name: io - sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b - url: "https://pub.dev" - source: hosted - version: "1.0.5" - js: - dependency: transitive - description: - name: js - sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc" - url: "https://pub.dev" - source: hosted - version: "0.7.2" - json_annotation: - dependency: transitive - description: - name: json_annotation - sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" - url: "https://pub.dev" - source: hosted - version: "4.9.0" - ken_logger: - dependency: "direct main" - description: - name: ken_logger - sha256: d48e3606688555a32a152a7d51c85a6f046b4157a6342812987c4722e90f998f - url: "https://pub.dev" - source: hosted - version: "0.0.3" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" - url: "https://pub.dev" - source: hosted - version: "10.0.9" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 - url: "https://pub.dev" - source: hosted - version: "3.0.9" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" - url: "https://pub.dev" - source: hosted - version: "3.0.1" - linkify: - dependency: transitive - description: - name: linkify - sha256: "4139ea77f4651ab9c315b577da2dd108d9aa0bd84b5d03d33323f1970c645832" - url: "https://pub.dev" - source: hosted - version: "5.0.0" - lints: - dependency: transitive - description: - name: lints - sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0 - url: "https://pub.dev" - source: hosted - version: "6.0.0" - local_auth: - dependency: "direct main" - description: - name: local_auth - sha256: "434d854cf478f17f12ab29a76a02b3067f86a63a6d6c4eb8fbfdcfe4879c1b7b" - url: "https://pub.dev" - source: hosted - version: "2.3.0" - local_auth_android: - dependency: transitive - description: - name: local_auth_android - sha256: "63ad7ca6396290626dc0cb34725a939e4cfe965d80d36112f08d49cf13a8136e" - url: "https://pub.dev" - source: hosted - version: "1.0.49" - local_auth_darwin: - dependency: transitive - description: - name: local_auth_darwin - sha256: "630996cd7b7f28f5ab92432c4b35d055dd03a747bc319e5ffbb3c4806a3e50d2" - url: "https://pub.dev" - source: hosted - version: "1.4.3" - local_auth_platform_interface: - dependency: transitive - description: - name: local_auth_platform_interface - sha256: "1b842ff177a7068442eae093b64abe3592f816afd2a533c0ebcdbe40f9d2075a" - url: "https://pub.dev" - source: hosted - version: "1.0.10" - local_auth_windows: - dependency: transitive - description: - name: local_auth_windows - sha256: bc4e66a29b0fdf751aafbec923b5bed7ad6ed3614875d8151afe2578520b2ab5 - url: "https://pub.dev" - source: hosted - version: "1.0.11" - logging: - dependency: transitive - description: - name: logging - sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 - url: "https://pub.dev" - source: hosted - version: "1.3.0" - markdown: - dependency: transitive - description: - name: markdown - sha256: "935e23e1ff3bc02d390bad4d4be001208ee92cc217cb5b5a6c19bc14aaa318c1" - url: "https://pub.dev" - source: hosted - version: "7.3.0" - matcher: - dependency: transitive - description: - name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 - url: "https://pub.dev" - source: hosted - version: "0.12.17" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec - url: "https://pub.dev" - source: hosted - version: "0.11.1" - math_expressions: - dependency: "direct main" - description: - name: math_expressions - sha256: "218dc65bed4726562bb31c53d8daa3cc824664b26fb72d77bc592757edf74ba0" - url: "https://pub.dev" - source: hosted - version: "2.7.0" - measure_size: - dependency: transitive - description: - name: measure_size - sha256: "5faef74474db7bbcd8c6f301d8a09abc69b8e999b85167825e532f1a55c38ae6" - url: "https://pub.dev" - source: hosted - version: "4.0.0" - meta: - dependency: transitive - description: - name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c - url: "https://pub.dev" - source: hosted - version: "1.16.0" - mime: - dependency: transitive - description: - name: mime - sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" - url: "https://pub.dev" - source: hosted - version: "2.0.0" - mobile_scanner: - dependency: "direct main" - description: - name: mobile_scanner - sha256: "54005bdea7052d792d35b4fef0f84ec5ddc3a844b250ecd48dc192fb9b4ebc95" - url: "https://pub.dev" - source: hosted - version: "7.0.1" - mutex: - dependency: transitive - description: - name: mutex - sha256: "8827da25de792088eb33e572115a5eb0d61d61a3c01acbc8bcbe76ed78f1a1f2" - url: "https://pub.dev" - source: hosted - version: "3.1.0" - nested: - dependency: transitive - description: - name: nested - sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" - url: "https://pub.dev" - source: hosted - version: "1.0.0" - octo_image: - dependency: transitive - description: - name: octo_image - sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd" - url: "https://pub.dev" - source: hosted - version: "2.1.0" - ollama_dart: - dependency: "direct main" - description: - name: ollama_dart - sha256: "55a45e381f3cf24791df510e287f353e776d376f556d34ba49b09bc918eee319" - url: "https://pub.dev" - source: hosted - version: "0.2.5" - os_detect: - dependency: transitive - description: - name: os_detect - sha256: "7d87c0dd98c6faf110d5aa498e9a6df02ffce4bb78cc9cfc8ad02929be9bb71f" - url: "https://pub.dev" - source: hosted - version: "2.0.3" - package_config: - dependency: transitive - description: - name: package_config - sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc - url: "https://pub.dev" - source: hosted - version: "2.2.0" - package_info_plus: - dependency: transitive - description: - name: package_info_plus - sha256: f69da0d3189a4b4ceaeb1a3defb0f329b3b352517f52bed4290f83d4f06bc08d - url: "https://pub.dev" - source: hosted - version: "9.0.0" - package_info_plus_platform_interface: - dependency: transitive - description: - name: package_info_plus_platform_interface - sha256: "202a487f08836a592a6bd4f901ac69b3a8f146af552bbd14407b6b41e1c3f086" - url: "https://pub.dev" - source: hosted - version: "3.2.1" - path: - dependency: transitive - description: - name: path - sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" - url: "https://pub.dev" - source: hosted - version: "1.9.1" - path_parsing: - dependency: transitive - description: - name: path_parsing - sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" - url: "https://pub.dev" - source: hosted - version: "1.1.0" - path_provider: - dependency: transitive - description: - name: path_provider - sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" - url: "https://pub.dev" - source: hosted - version: "2.1.5" - path_provider_android: - dependency: transitive - description: - name: path_provider_android - sha256: d0d310befe2c8ab9e7f393288ccbb11b60c019c6b5afc21973eeee4dda2b35e9 - url: "https://pub.dev" - source: hosted - version: "2.2.17" - path_provider_foundation: - dependency: transitive - description: - name: path_provider_foundation - sha256: "4843174df4d288f5e29185bd6e72a6fbdf5a4a4602717eed565497429f179942" - url: "https://pub.dev" - source: hosted - version: "2.4.1" - path_provider_linux: - dependency: transitive - description: - name: path_provider_linux - sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 - url: "https://pub.dev" - source: hosted - version: "2.2.1" - path_provider_platform_interface: - dependency: transitive - description: - name: path_provider_platform_interface - sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - path_provider_windows: - dependency: transitive - description: - name: path_provider_windows - sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 - url: "https://pub.dev" - source: hosted - version: "2.3.0" - pdf: - dependency: transitive - description: - name: pdf - sha256: "28eacad99bffcce2e05bba24e50153890ad0255294f4dd78a17075a2ba5c8416" - url: "https://pub.dev" - source: hosted - version: "3.11.3" - pdf_widget_wrapper: - dependency: transitive - description: - name: pdf_widget_wrapper - sha256: c930860d987213a3d58c7ec3b7ecf8085c3897f773e8dc23da9cae60a5d6d0f5 - url: "https://pub.dev" - source: hosted - version: "1.0.4" - petitparser: - dependency: transitive - description: - name: petitparser - sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646" - url: "https://pub.dev" - source: hosted - version: "6.1.0" - photo_view: - dependency: transitive - description: - name: photo_view - sha256: "1fc3d970a91295fbd1364296575f854c9863f225505c28c46e0a03e48960c75e" - url: "https://pub.dev" - source: hosted - version: "0.15.0" - platform: - dependency: transitive - description: - name: platform - sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" - url: "https://pub.dev" - source: hosted - version: "3.1.6" - plugin_platform_interface: - dependency: transitive - description: - name: plugin_platform_interface - sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" - url: "https://pub.dev" - source: hosted - version: "2.1.8" - pool: - dependency: transitive - description: - name: pool - sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" - url: "https://pub.dev" - source: hosted - version: "1.5.1" - posix: - dependency: transitive - description: - name: posix - sha256: f0d7856b6ca1887cfa6d1d394056a296ae33489db914e365e2044fdada449e62 - url: "https://pub.dev" - source: hosted - version: "6.0.2" - printing: - dependency: "direct main" - description: - name: printing - sha256: "482cd5a5196008f984bb43ed0e47cbfdca7373490b62f3b27b3299275bf22a93" - url: "https://pub.dev" - source: hosted - version: "5.14.2" - protobuf: - dependency: transitive - description: - name: protobuf - sha256: "579fe5557eae58e3adca2e999e38f02441d8aa908703854a9e0a0f47fa857731" - url: "https://pub.dev" - source: hosted - version: "4.1.0" - provider: - dependency: "direct main" - description: - name: provider - sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272" - url: "https://pub.dev" - source: hosted - version: "6.1.5+1" - pub_semver: - dependency: transitive - description: - name: pub_semver - sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" - url: "https://pub.dev" - source: hosted - version: "2.2.0" - pubspec_parse: - dependency: transitive - description: - name: pubspec_parse - sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082" - url: "https://pub.dev" - source: hosted - version: "1.5.0" - pwa_install: - dependency: "direct main" - description: - name: pwa_install - sha256: "77fbb93d064d0cda0657f61386958562a13a7e57a2ce2a8b6da707d3bcef43c5" - url: "https://pub.dev" - source: hosted - version: "0.0.6" - qr: - dependency: transitive - description: - name: qr - sha256: "5a1d2586170e172b8a8c8470bbbffd5eb0cd38a66c0d77155ea138d3af3a4445" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - quick_actions: - dependency: "direct main" - description: - name: quick_actions - sha256: "7e35dd6a21f5bbd21acf6899039eaf85001a5ac26d52cbd6a8a2814505b90798" - url: "https://pub.dev" - source: hosted - version: "1.1.0" - quick_actions_android: - dependency: transitive - description: - name: quick_actions_android - sha256: "612c9d53364c641ddcdeafed83c68fc14efb1bf4f686979d755024fc976fc888" - url: "https://pub.dev" - source: hosted - version: "1.0.23" - quick_actions_ios: - dependency: transitive - description: - name: quick_actions_ios - sha256: ee2cd54e3bd674eb031ca195b3b9974583638d141493aec1066dee3b2599ed08 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - quick_actions_platform_interface: - dependency: transitive - description: - name: quick_actions_platform_interface - sha256: "1fec7068db5122cd019e9340d3d7be5d36eab099695ef3402c7059ee058329a4" - url: "https://pub.dev" - source: hosted - version: "1.1.0" - record: - dependency: transitive - description: - name: record - sha256: "6bad72fb3ea6708d724cf8b6c97c4e236cf9f43a52259b654efeb6fd9b737f1f" - url: "https://pub.dev" - source: hosted - version: "6.1.2" - record_android: - dependency: transitive - description: - name: record_android - sha256: fb54ee4e28f6829b8c580252a9ef49d9c549cfd263b0660ad7eeac0908658e9f - url: "https://pub.dev" - source: hosted - version: "1.4.4" - record_ios: - dependency: transitive - description: - name: record_ios - sha256: "765b42ac1be019b1674ddd809b811fc721fe5a93f7bb1da7803f0d16772fd6d7" - url: "https://pub.dev" - source: hosted - version: "1.1.4" - record_linux: - dependency: transitive - description: - name: record_linux - sha256: "235b1f1fb84e810f8149cc0c2c731d7d697f8d1c333b32cb820c449bf7bb72d8" - url: "https://pub.dev" - source: hosted - version: "1.2.1" - record_macos: - dependency: transitive - description: - name: record_macos - sha256: "842ea4b7e95f4dd237aacffc686d1b0ff4277e3e5357865f8d28cd28bc18ed95" - url: "https://pub.dev" - source: hosted - version: "1.1.2" - record_platform_interface: - dependency: transitive - description: - name: record_platform_interface - sha256: b0065fdf1ec28f5a634d676724d388a77e43ce7646fb049949f58c69f3fcb4ed - url: "https://pub.dev" - source: hosted - version: "1.4.0" - record_web: - dependency: transitive - description: - name: record_web - sha256: "20ac10d56514cb9f8cecc8f3579383084fdfb43b0d04e05a95244d0d76091d90" - url: "https://pub.dev" - source: hosted - version: "1.2.1" - record_windows: - dependency: transitive - description: - name: record_windows - sha256: "223258060a1d25c62bae18282c16783f28581ec19401d17e56b5205b9f039d78" - url: "https://pub.dev" - source: hosted - version: "1.0.7" - redacted: - dependency: "direct main" - description: - name: redacted - sha256: "56647696716c2aacaa9532ef88067b4d2d090f744f411a823bb41f57b814b23a" - url: "https://pub.dev" - source: hosted - version: "1.0.13" - rxdart: - dependency: transitive - description: - name: rxdart - sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962" - url: "https://pub.dev" - source: hosted - version: "0.28.0" - scratch_space: - dependency: transitive - description: - name: scratch_space - sha256: "8510fbff458d733a58fc427057d1ac86303b376d609d6e1bc43f240aad9aa445" - url: "https://pub.dev" - source: hosted - version: "1.0.2" - screen_brightness: - dependency: "direct main" - description: - name: screen_brightness - sha256: b6cb9381b83fef7be74187ea043d54598b9a265b4ef6e40b69345ae28699b13e - url: "https://pub.dev" - source: hosted - version: "2.1.6" - screen_brightness_android: - dependency: transitive - description: - name: screen_brightness_android - sha256: fb5fa43cb89d0c9b8534556c427db1e97e46594ac5d66ebdcf16063b773d54ed - url: "https://pub.dev" - source: hosted - version: "2.1.2" - screen_brightness_ios: - dependency: transitive - description: - name: screen_brightness_ios - sha256: "2493953340ecfe8f4f13f61db50ce72533a55b0bbd58ba1402893feecf3727f5" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - screen_brightness_macos: - dependency: transitive - description: - name: screen_brightness_macos - sha256: "4edf330ad21078686d8bfaf89413325fbaf571dcebe1e89254d675a3f288b5b9" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - screen_brightness_ohos: - dependency: transitive - description: - name: screen_brightness_ohos - sha256: af2680660f7df785bcd2b1bef9b9f3c172191166dd27098f2dfe020c50c3dea4 - url: "https://pub.dev" - source: hosted - version: "2.1.1" - screen_brightness_platform_interface: - dependency: transitive - description: - name: screen_brightness_platform_interface - sha256: "737bd47b57746bc4291cab1b8a5843ee881af499514881b0247ec77447ee769c" - url: "https://pub.dev" - source: hosted - version: "2.1.0" - screen_brightness_windows: - dependency: transitive - description: - name: screen_brightness_windows - sha256: d3518bf0f5d7a884cee2c14449ae0b36803802866de09f7ef74077874b6b2448 - url: "https://pub.dev" - source: hosted - version: "2.1.0" - screenshot: - dependency: "direct main" - description: - name: screenshot - sha256: "63817697a7835e6ce82add4228e15d233b74d42975c143ad8cfe07009fab866b" - url: "https://pub.dev" - source: hosted - version: "3.0.0" - scroll_to_index: - dependency: transitive - description: - name: scroll_to_index - sha256: b707546e7500d9f070d63e5acf74fd437ec7eeeb68d3412ef7b0afada0b4f176 - url: "https://pub.dev" - source: hosted - version: "3.0.1" - share_plus: - dependency: "direct main" - description: - name: share_plus - sha256: b2961506569e28948d75ec346c28775bb111986bb69dc6a20754a457e3d97fa0 - url: "https://pub.dev" - source: hosted - version: "11.0.0" - share_plus_platform_interface: - dependency: transitive - description: - name: share_plus_platform_interface - sha256: "1032d392bc5d2095a77447a805aa3f804d2ae6a4d5eef5e6ebb3bd94c1bc19ef" - url: "https://pub.dev" - source: hosted - version: "6.0.0" - shared_preferences: - dependency: transitive - description: - name: shared_preferences - sha256: "6e8bf70b7fef813df4e9a36f658ac46d107db4b4cfe1048b477d4e453a8159f5" - url: "https://pub.dev" - source: hosted - version: "2.5.3" - shared_preferences_android: - dependency: transitive - description: - name: shared_preferences_android - sha256: "20cbd561f743a342c76c151d6ddb93a9ce6005751e7aa458baad3858bfbfb6ac" - url: "https://pub.dev" - source: hosted - version: "2.4.10" - shared_preferences_foundation: - dependency: transitive - description: - name: shared_preferences_foundation - sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03" - url: "https://pub.dev" - source: hosted - version: "2.5.4" - shared_preferences_linux: - dependency: transitive - description: - name: shared_preferences_linux - sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" - url: "https://pub.dev" - source: hosted - version: "2.4.1" - shared_preferences_platform_interface: - dependency: transitive - description: - name: shared_preferences_platform_interface - sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" - url: "https://pub.dev" - source: hosted - version: "2.4.1" - shared_preferences_web: - dependency: transitive - description: - name: shared_preferences_web - sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 - url: "https://pub.dev" - source: hosted - version: "2.4.3" - shared_preferences_windows: - dependency: transitive - description: - name: shared_preferences_windows - sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" - url: "https://pub.dev" - source: hosted - version: "2.4.1" - shelf: - dependency: transitive - description: - name: shelf - sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 - url: "https://pub.dev" - source: hosted - version: "1.4.2" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925" - url: "https://pub.dev" - source: hosted - version: "3.0.0" - simple_gesture_detector: - dependency: transitive - description: - name: simple_gesture_detector - sha256: ba2cd5af24ff20a0b8d609cec3f40e5b0744d2a71804a2616ae086b9c19d19a3 - url: "https://pub.dev" - source: hosted - version: "0.2.1" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - source_maps: - dependency: transitive - description: - name: source_maps - sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812" - url: "https://pub.dev" - source: hosted - version: "0.10.13" - source_span: - dependency: transitive - description: - name: source_span - sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" - url: "https://pub.dev" - source: hosted - version: "1.10.1" - sprintf: - dependency: transitive - description: - name: sprintf - sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" - url: "https://pub.dev" - source: hosted - version: "7.0.0" - sqflite: - dependency: transitive - description: - name: sqflite - sha256: e2297b1da52f127bc7a3da11439985d9b536f75070f3325e62ada69a5c585d03 - url: "https://pub.dev" - source: hosted - version: "2.4.2" - sqflite_android: - dependency: transitive - description: - name: sqflite_android - sha256: "2b3070c5fa881839f8b402ee4a39c1b4d561704d4ebbbcfb808a119bc2a1701b" - url: "https://pub.dev" - source: hosted - version: "2.4.1" - sqflite_common: - dependency: transitive - description: - name: sqflite_common - sha256: "6ef422a4525ecc601db6c0a2233ff448c731307906e92cabc9ba292afaae16a6" - url: "https://pub.dev" - source: hosted - version: "2.5.6" - sqflite_darwin: - dependency: transitive - description: - name: sqflite_darwin - sha256: "279832e5cde3fe99e8571879498c9211f3ca6391b0d818df4e17d9fff5c6ccb3" - url: "https://pub.dev" - source: hosted - version: "2.4.2" - sqflite_platform_interface: - dependency: transitive - description: - name: sqflite_platform_interface - sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920" - url: "https://pub.dev" - source: hosted - version: "2.4.0" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" - url: "https://pub.dev" - source: hosted - version: "1.12.1" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - stream_transform: - dependency: transitive - description: - name: stream_transform - sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 - url: "https://pub.dev" - source: hosted - version: "2.1.1" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" - url: "https://pub.dev" - source: hosted - version: "1.4.1" - supertokens_flutter: - dependency: "direct main" - description: - name: supertokens_flutter - sha256: "54ebc0ba9269ae17dc8d26c524cca53a6f0c9155625331839954aa9294a63821" - url: "https://pub.dev" - source: hosted - version: "0.6.3" - syncfusion_flutter_core: - dependency: "direct main" - description: - name: syncfusion_flutter_core - sha256: "0e1e1f50edca35bf1a36c75ebd9c4bef722d3ff9998dac9cee3bf11745639d6a" - url: "https://pub.dev" - source: hosted - version: "29.2.10" - syncfusion_flutter_pdf: - dependency: transitive - description: - name: syncfusion_flutter_pdf - sha256: "7610e12ef69a072705d051f506751518aff91fd76d581d3fbde73fd776ca003c" - url: "https://pub.dev" - source: hosted - version: "29.2.10" - syncfusion_flutter_pdfviewer: - dependency: "direct main" - description: - name: syncfusion_flutter_pdfviewer - sha256: e656bda13b923bd0abaaec826990e57f404c865e13f805f210d50a9c96fc8202 - url: "https://pub.dev" - source: hosted - version: "29.2.10" - syncfusion_flutter_signaturepad: - dependency: transitive - description: - name: syncfusion_flutter_signaturepad - sha256: "65f812d4e8f54fde8e262c7936627488a9aea294ec4dcc11ac1ddbf147ea0b86" - url: "https://pub.dev" - source: hosted - version: "29.2.10" - syncfusion_pdfviewer_macos: - dependency: transitive - description: - name: syncfusion_pdfviewer_macos - sha256: "1cba449d5695044d1ced21cbc1e5c45553d5f3523ad3e8842e0cdd7ccf6d35be" - url: "https://pub.dev" - source: hosted - version: "29.2.10" - syncfusion_pdfviewer_platform_interface: - dependency: transitive - description: - name: syncfusion_pdfviewer_platform_interface - sha256: "93244ccbb1f7663fa9988f8c22845f7106e28eccff83685825302c8ddded0861" - url: "https://pub.dev" - source: hosted - version: "29.2.10" - syncfusion_pdfviewer_web: - dependency: transitive - description: - name: syncfusion_pdfviewer_web - sha256: "25e5a91a04a2016907e17552b0581f58d401489d8d5ad9cdefd5be74c0f6ab1d" - url: "https://pub.dev" - source: hosted - version: "29.2.10" - syncfusion_pdfviewer_windows: - dependency: transitive - description: - name: syncfusion_pdfviewer_windows - sha256: "6dbc08118892a77a269a73f20074093dd3f5e47af5125a296e4080e0858b1a56" - url: "https://pub.dev" - source: hosted - version: "29.2.10" - synchronized: - dependency: transitive - description: - name: synchronized - sha256: c254ade258ec8282947a0acbbc90b9575b4f19673533ee46f2f6e9b3aeefd7c0 - url: "https://pub.dev" - source: hosted - version: "3.4.0" - table_calendar: - dependency: "direct main" - description: - name: table_calendar - sha256: "0c0c6219878b363a2d5f40c7afb159d845f253d061dc3c822aa0d5fe0f721982" - url: "https://pub.dev" - source: hosted - version: "3.2.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" - url: "https://pub.dev" - source: hosted - version: "1.2.2" - test_api: - dependency: transitive - description: - name: test_api - sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd - url: "https://pub.dev" - source: hosted - version: "0.7.4" - timing: - dependency: transitive - description: - name: timing - sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" - url: "https://pub.dev" - source: hosted - version: "1.0.2" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 - url: "https://pub.dev" - source: hosted - version: "1.4.0" - universal_html: - dependency: "direct main" - description: - name: universal_html - sha256: "56536254004e24d9d8cfdb7dbbf09b74cf8df96729f38a2f5c238163e3d58971" - url: "https://pub.dev" - source: hosted - version: "2.2.4" - universal_io: - dependency: transitive - description: - name: universal_io - sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad" - url: "https://pub.dev" - source: hosted - version: "2.2.2" - universal_platform: - dependency: transitive - description: - name: universal_platform - sha256: "64e16458a0ea9b99260ceb5467a214c1f298d647c659af1bff6d3bf82536b1ec" - url: "https://pub.dev" - source: hosted - version: "1.1.0" - upgrader: - dependency: "direct main" - description: - name: upgrader - sha256: e4878f33198ed627af9ec64cb12626ca12672ad94e9671feccd58625ccb484b6 - url: "https://pub.dev" - source: hosted - version: "12.0.0" - url_launcher: - dependency: "direct main" - description: - name: url_launcher - sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" - url: "https://pub.dev" - source: hosted - version: "6.3.1" - url_launcher_android: - dependency: transitive - description: - name: url_launcher_android - sha256: "8582d7f6fe14d2652b4c45c9b6c14c0b678c2af2d083a11b604caeba51930d79" - url: "https://pub.dev" - source: hosted - version: "6.3.16" - url_launcher_ios: - dependency: transitive - description: - name: url_launcher_ios - sha256: "7f2022359d4c099eea7df3fdf739f7d3d3b9faf3166fb1dd390775176e0b76cb" - url: "https://pub.dev" - source: hosted - version: "6.3.3" - url_launcher_linux: - dependency: transitive - description: - name: url_launcher_linux - sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" - url: "https://pub.dev" - source: hosted - version: "3.2.1" - url_launcher_macos: - dependency: transitive - description: - name: url_launcher_macos - sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2" - url: "https://pub.dev" - source: hosted - version: "3.2.2" - url_launcher_platform_interface: - dependency: transitive - description: - name: url_launcher_platform_interface - sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" - url: "https://pub.dev" - source: hosted - version: "2.3.2" - url_launcher_web: - dependency: transitive - description: - name: url_launcher_web - sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2" - url: "https://pub.dev" - source: hosted - version: "2.4.1" - url_launcher_windows: - dependency: transitive - description: - name: url_launcher_windows - sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77" - url: "https://pub.dev" - source: hosted - version: "3.1.4" - uuid: - dependency: "direct main" - description: - name: uuid - sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff - url: "https://pub.dev" - source: hosted - version: "4.5.1" - vector_graphics: - dependency: transitive - description: - name: vector_graphics - sha256: a4f059dc26fc8295b5921376600a194c4ec7d55e72f2fe4c7d2831e103d461e6 - url: "https://pub.dev" - source: hosted - version: "1.1.19" - vector_graphics_codec: - dependency: transitive - description: - name: vector_graphics_codec - sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146" - url: "https://pub.dev" - source: hosted - version: "1.1.13" - vector_graphics_compiler: - dependency: transitive - description: - name: vector_graphics_compiler - sha256: "557a315b7d2a6dbb0aaaff84d857967ce6bdc96a63dc6ee2a57ce5a6ee5d3331" - url: "https://pub.dev" - source: hosted - version: "1.1.17" - vector_math: - dependency: transitive - description: - name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - version: - dependency: transitive - description: - name: version - sha256: "3d4140128e6ea10d83da32fef2fa4003fccbf6852217bb854845802f04191f94" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - visibility_detector: - dependency: transitive - description: - name: visibility_detector - sha256: dd5cc11e13494f432d15939c3aa8ae76844c42b723398643ce9addb88a5ed420 - url: "https://pub.dev" - source: hosted - version: "0.4.0+2" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 - url: "https://pub.dev" - source: hosted - version: "15.0.0" - watcher: - dependency: transitive - description: - name: watcher - sha256: "69da27e49efa56a15f8afe8f4438c4ec02eff0a117df1b22ea4aad194fe1c104" - url: "https://pub.dev" - source: hosted - version: "1.1.1" - waveform_flutter: - dependency: transitive - description: - name: waveform_flutter - sha256: "08c9e98d4cf119428d8b3c083ed42c11c468623eaffdf30420ae38e36662922a" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - waveform_recorder: - dependency: transitive - description: - name: waveform_recorder - sha256: "1ca0a19b143d1bdef2adfb3d28f0627c18aee5285235c8cf81a89bf29a0420e1" - url: "https://pub.dev" - source: hosted - version: "1.8.0" - web: - dependency: transitive - description: - name: web - sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" - url: "https://pub.dev" - source: hosted - version: "1.1.1" - web_socket: - dependency: transitive - description: - name: web_socket - sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" - url: "https://pub.dev" - source: hosted - version: "1.0.1" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 - url: "https://pub.dev" - source: hosted - version: "3.0.3" - webview_flutter: - dependency: transitive - description: - name: webview_flutter - sha256: c3e4fe614b1c814950ad07186007eff2f2e5dd2935eba7b9a9a1af8e5885f1ba - url: "https://pub.dev" - source: hosted - version: "4.13.0" - webview_flutter_android: - dependency: transitive - description: - name: webview_flutter_android - sha256: f6e6afef6e234801da77170f7a1847ded8450778caf2fe13979d140484be3678 - url: "https://pub.dev" - source: hosted - version: "4.7.0" - webview_flutter_platform_interface: - dependency: transitive - description: - name: webview_flutter_platform_interface - sha256: f0dc2dc3a2b1e3a6abdd6801b9355ebfeb3b8f6cde6b9dc7c9235909c4a1f147 - url: "https://pub.dev" - source: hosted - version: "2.13.1" - webview_flutter_wkwebview: - dependency: transitive - description: - name: webview_flutter_wkwebview - sha256: a3d461fe3467014e05f3ac4962e5fdde2a4bf44c561cb53e9ae5c586600fdbc3 - url: "https://pub.dev" - source: hosted - version: "3.22.0" - win32: - dependency: transitive - description: - name: win32 - sha256: "329edf97fdd893e0f1e3b9e88d6a0e627128cc17cc316a8d67fda8f1451178ba" - url: "https://pub.dev" - source: hosted - version: "5.13.0" - win32_registry: - dependency: transitive - description: - name: win32_registry - sha256: "6f1b564492d0147b330dd794fee8f512cec4977957f310f9951b5f9d83618dae" - url: "https://pub.dev" - source: hosted - version: "2.1.0" - xdg_directories: - dependency: transitive - description: - name: xdg_directories - sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" - url: "https://pub.dev" - source: hosted - version: "1.1.0" - xml: - dependency: transitive - description: - name: xml - sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 - url: "https://pub.dev" - source: hosted - version: "6.5.0" - yaml: - dependency: transitive - description: - name: yaml - sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce - url: "https://pub.dev" - source: hosted - version: "3.1.3" - youtube_player_iframe: - dependency: "direct main" - description: - name: youtube_player_iframe - sha256: "66020f7756accfb22b3297565d845f9bef14249c730dd51e1ec648fa155fb24a" - url: "https://pub.dev" - source: hosted - version: "5.2.1" - youtube_player_iframe_web: - dependency: transitive - description: - name: youtube_player_iframe_web - sha256: "05222a228937932e7ee7a6171e8020fee4cd23d1c7bf6b4128c569484338c593" - url: "https://pub.dev" - source: hosted - version: "3.1.1" -sdks: - dart: ">=3.8.1 <3.9.0" - flutter: ">=3.29.0" diff --git a/mih_ui/pubspec.yaml b/mih_ui/pubspec.yaml deleted file mode 100644 index 2614956c..00000000 --- a/mih_ui/pubspec.yaml +++ /dev/null @@ -1,105 +0,0 @@ -name: mzansi_innovation_hub -description: "" -publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 1.2.6+130 -# version: 1.1.1+97 #--- Updated version for upgrader package testing - -environment: - sdk: '>=3.5.3 <4.0.0' - # flutter: ">=1.17.0" -dependencies: - flutter: - sdk: flutter - flutter_web_plugins: - sdk: flutter - flutter_dotenv: ^6.0.0 - - cupertino_icons: ^1.0.8 - font_awesome_flutter: ^10.7.0 - # firebase_core: ^4.4.0 - # firebase_core_desktop: ^1.0.2 - syncfusion_flutter_core: ^29.2.10 - syncfusion_flutter_pdfviewer: ^29.2.10 - universal_html: ^2.2.4 - file_picker: ^10.1.9 - supertokens_flutter: ^0.6.3 - http: ^1.2.1 - args: ^2.7.0 - intl: ^0.20.2 - flutter_native_splash: ^2.4.6 - printing: ^5.13.3 - geolocator: ^14.0.1 - geolocator_linux: ^0.2.4 - table_calendar: ^3.1.2 - youtube_player_iframe: ^5.2.0 - mobile_scanner: ^7.0.1 - flutter_launcher_icons: ^0.14.4 - barcode_widget: ^2.0.4 #Generate Barcodes - url_launcher: ^6.3.1 - fl_downloader: ^2.0.2 - local_auth: ^2.3.0 - math_expressions: ^2.6.0 - ollama_dart: ^0.2.2+1 - flutter_chat_ui: ^1.6.15 - flutter_chat_types: ^3.6.2 - uuid: ^4.5.1 - flutter_tts: ^4.2.3 - flutter_speed_dial: ^7.0.0 - share_plus: ^11.0.0 - app_settings: ^6.1.1 - pwa_install: ^0.0.6 - google_mobile_ads: ^6.0.0 - gma_mediation_meta: ^1.4.1 - redacted: ^1.0.13 - custom_rating_bar: ^3.0.0 - country_code_picker: ^3.3.0 - ken_logger: ^0.0.3 - go_router: ^16.1.0 - screen_brightness: ^2.1.6 - cached_network_image: ^3.4.1 - upgrader: ^12.0.0 - screenshot: ^3.0.0 - file_saver: ^0.3.1 - provider: ^6.1.5+1 - flutter_ai_toolkit: ^0.10.0 - flutter_markdown_plus: ^1.0.5 - cross_file: ^0.3.5+1 - quick_actions: ^1.1.0 - -dev_dependencies: - flutter_test: - sdk: flutter - - build_runner: ^2.4.8 - - build_web_compilers: ^4.1.5 - flutter_lints: ^6.0.0 - -flutter: - uses-material-design: true - assets: - - .env - - lib/mih_package_components/assets/images/ - - lib/mih_package_components/assets/fonts/ - - lib/mih_package_components/assets/images/loyalty_cards/ - - lib/mih_package_components/assets/images/loyalty_cards/mini/ - - lib/mih_package_components/assets/images/app_icon/ - - lib/mih_package_components/assets/images/splash_screen/ - - fonts: - - family: MihIcons - fonts: - - asset: lib/mih_package_components/assets/fonts/Mih_Icons.ttf - -flutter_native_splash: - color: "#3A4454" - image: lib/mih_package_components/assets/images/splash_screen/mih_image_splash.png - branding: lib/mih_package_components/assets/images/splash_screen/mih_branding_splash.png - image_web: lib/mih_package_components/assets/images/splash_screen/mih_image_splash_temp.gif - branding_web: lib/mih_package_components/assets/images/splash_screen/mih_branding_splash_temp.gif - branding_mode: bottom - branding_bottom_padding: 24 - android_12: - color: "#3A4454" - image: lib/mih_package_components/assets/images/splash_screen/mih_image_splash_android.png - branding: lib/mih_package_components/assets/images/splash_screen/mih_branding_splash.png \ No newline at end of file diff --git a/mih_ui/web/.well-known/apple-app-site-association b/mih_ui/web/.well-known/apple-app-site-association deleted file mode 100644 index 2fa7acc2..00000000 --- a/mih_ui/web/.well-known/apple-app-site-association +++ /dev/null @@ -1,25 +0,0 @@ -{ - "applinks": { - "apps": [], - "details": [ - { - "appIDs": [ - "B88N73P46W.za.co.mzansiinnovationhub.mih" - ], - "paths": [ - "*" - ], - "components": [ - { - "/": "/*" - } - ] - } - ] - }, - "webcredentials": { - "apps": [ - "B88N73P46W.za.co.mzansiinnovationhub.mih" - ] - } -} \ No newline at end of file diff --git a/mih_ui/web/.well-known/assetlinks.json b/mih_ui/web/.well-known/assetlinks.json deleted file mode 100644 index e3c8939e..00000000 --- a/mih_ui/web/.well-known/assetlinks.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "relation": [ - "delegate_permission/common.handle_all_urls", - "delegate_permission/common.get_login_creds" - ], - "target": { - "namespace": "android_app", - "package_name": "za.co.mzansiinnovationhub.mih", - "sha256_cert_fingerprints": [ - "51:4C:93:E3:11:85:C5:7A:46:A9:C4:88:B7:E4:96:7F:41:11:80:4C:A4:2D:2D:55:30:C2:0B:A6:20:25:1E:98" - ] - } - } -] \ No newline at end of file diff --git a/mih_ui/web/app-ads.txt b/mih_ui/web/app-ads.txt deleted file mode 100644 index 503c0c31..00000000 --- a/mih_ui/web/app-ads.txt +++ /dev/null @@ -1,2 +0,0 @@ -google.com, pub-4781880856775334, DIRECT, f08c47fec0942fa0 -facebook.com, 772289761950104, DIRECT, c3e20eee3f780d68 \ No newline at end of file diff --git a/mih_ui/web/favicon.ico b/mih_ui/web/favicon.ico deleted file mode 100644 index a37abadf..00000000 Binary files a/mih_ui/web/favicon.ico and /dev/null differ diff --git a/mih_ui/web/favicon.png b/mih_ui/web/favicon.png deleted file mode 100644 index 494c06e9..00000000 Binary files a/mih_ui/web/favicon.png and /dev/null differ diff --git a/mih_ui/web/google5430e48350b861fe.html b/mih_ui/web/google5430e48350b861fe.html deleted file mode 100644 index 2f55d01f..00000000 --- a/mih_ui/web/google5430e48350b861fe.html +++ /dev/null @@ -1 +0,0 @@ -google-site-verification: google5430e48350b861fe.html \ No newline at end of file diff --git a/mih_ui/web/icons/Icon-192.png b/mih_ui/web/icons/Icon-192.png deleted file mode 100644 index 9d1b1540..00000000 Binary files a/mih_ui/web/icons/Icon-192.png and /dev/null differ diff --git a/mih_ui/web/icons/Icon-512.png b/mih_ui/web/icons/Icon-512.png deleted file mode 100644 index d6bb6b00..00000000 Binary files a/mih_ui/web/icons/Icon-512.png and /dev/null differ diff --git a/mih_ui/web/icons/Icon-maskable-192.png b/mih_ui/web/icons/Icon-maskable-192.png deleted file mode 100644 index 9d1b1540..00000000 Binary files a/mih_ui/web/icons/Icon-maskable-192.png and /dev/null differ diff --git a/mih_ui/web/icons/Icon-maskable-512.png b/mih_ui/web/icons/Icon-maskable-512.png deleted file mode 100644 index d6bb6b00..00000000 Binary files a/mih_ui/web/icons/Icon-maskable-512.png and /dev/null differ diff --git a/mih_ui/web/icons/android-chrome-192x192.png b/mih_ui/web/icons/android-chrome-192x192.png deleted file mode 100644 index 2a9c4f7c..00000000 Binary files a/mih_ui/web/icons/android-chrome-192x192.png and /dev/null differ diff --git a/mih_ui/web/icons/android-chrome-512x512.png b/mih_ui/web/icons/android-chrome-512x512.png deleted file mode 100644 index d643bbac..00000000 Binary files a/mih_ui/web/icons/android-chrome-512x512.png and /dev/null differ diff --git a/mih_ui/web/icons/apple-touch-icon.png b/mih_ui/web/icons/apple-touch-icon.png deleted file mode 100644 index d05aa615..00000000 Binary files a/mih_ui/web/icons/apple-touch-icon.png and /dev/null differ diff --git a/mih_ui/web/icons/favicon-16x16.png b/mih_ui/web/icons/favicon-16x16.png deleted file mode 100644 index 331a74fc..00000000 Binary files a/mih_ui/web/icons/favicon-16x16.png and /dev/null differ diff --git a/mih_ui/web/icons/favicon-32x32.png b/mih_ui/web/icons/favicon-32x32.png deleted file mode 100644 index b6fc3410..00000000 Binary files a/mih_ui/web/icons/favicon-32x32.png and /dev/null differ diff --git a/mih_ui/web/icons/favicon.ico b/mih_ui/web/icons/favicon.ico deleted file mode 100644 index e2e50f24..00000000 Binary files a/mih_ui/web/icons/favicon.ico and /dev/null differ diff --git a/mih_ui/web/index.html b/mih_ui/web/index.html deleted file mode 100644 index 28d53ad3..00000000 --- a/mih_ui/web/index.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - MIH App: Mzansi Innovation Hub - All-in-One Super App for Business & Personal Life - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mih_ui/web/install_pwa.js b/mih_ui/web/install_pwa.js deleted file mode 100644 index c6b796e6..00000000 --- a/mih_ui/web/install_pwa.js +++ /dev/null @@ -1,33 +0,0 @@ -let deferredPrompt; - -// add to homescreen -window.addEventListener("beforeinstallprompt", (e) => { - // Prevent Chrome 67 and earlier from automatically showing the prompt - e.preventDefault(); - // Stash the event so it can be triggered later. - deferredPrompt = e; -}); - -function isDeferredNotNull() { - return deferredPrompt != null; -} - -function presentAddToHome() { - if (deferredPrompt != null) { - // Update UI to notify the user they can add to home screen - // Show the prompt - deferredPrompt.prompt(); - // Wait for the user to respond to the prompt - deferredPrompt.userChoice.then((choiceResult) => { - if (choiceResult.outcome === "accepted") { - console.log("User accepted the A2HS prompt"); - } else { - console.log("User dismissed the A2HS prompt"); - } - deferredPrompt = null; - }); - } else { - console.log("deferredPrompt is null"); - return null; - } -} \ No newline at end of file diff --git a/mih_ui/web/manifest.json b/mih_ui/web/manifest.json deleted file mode 100644 index e8ad7e18..00000000 --- a/mih_ui/web/manifest.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "Mzansi Innovation Hub", - "short_name": "MIH", - "start_url": ".", - "display": "standalone", - "background_color": "#3A4454", - "theme_color": "#3A4454", - "description": "Digitizing Mzansi one process at a time. Discover essential Mzansi apps to streamline your personal and professional life. Simplify your daily tasks with our user-friendly solutions.", - "orientation": "any", - "prefer_related_applications": false, - "icons": [ - { - "src": "icons/Icon-192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "icons/Icon-512.png", - "sizes": "512x512", - "type": "image/png" - }, - { - "src": "icons/Icon-maskable-192.png", - "sizes": "192x192", - "type": "image/png", - "purpose": "maskable" - }, - { - "src": "icons/Icon-maskable-512.png", - "sizes": "512x512", - "type": "image/png", - "purpose": "maskable" - } - ] -} \ No newline at end of file diff --git a/mih_ui/web/privacy-simplified-chinese.html b/mih_ui/web/privacy-simplified-chinese.html deleted file mode 100644 index 4d1df4c2..00000000 --- a/mih_ui/web/privacy-simplified-chinese.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - -

隐私政策

- - - -

生效日期: 2024年12月6日

- Mzansi Innovation Hub - MIH(“我们”)重视您的隐私,并致力于保护您的个人数据。本隐私政策解释了当您使用我们面向全球推出的应用程序 Mzansi Innovation Hub - MIH - 时,我们如何收集、使用、披露和保护您的信息。 -

-

1. 我们收集的信息

-

- 我们收集以下个人信息以提供和改进我们的服务: -

    -
  • 个人信息:姓名、身份证号、地址、电话号码等。
  • -
  • 医疗信息:医疗援助信息(如适用)。
  • -
  • 会员卡信息:用于 Mzansi Wallet 功能的会员卡号。
  • -
-

-

2. 我们如何使用您的信息

-

- 您的个人信息将用于以下目的: -

    -
  • 创建和管理您的帐户。
  • -
  • 促进客户与企业之间的互动。
  • -
  • 在 Mzansi Wallet 中存储会员卡信息。
  • -
  • 提供技术支持并改进我们应用程序的功能。
  • -
-

-

3. 数据共享

-

- 我们仅在以下情况下共享您的数据: -

    -
  • 征得您的同意:企业只有在您明确许可的情况下才能访问您的信息。
  • -
  • 法律义务:我们可能会根据适用法律法规披露信息。
  • -
-

-

4. 数据安全

-

我们实施先进的安全措施来保护您的个人数据: -

    -
  • 传输过程中的数据加密。
  • -
  • 安全的身份验证协议,以防止未经授权的访问。
  • -
  • 定期审核以识别和解决漏洞。
  • -
-

-

5. 您的权利

-

您对您的个人数据拥有以下权利: -

    -
  • 访问和更正:通过您的帐户设置查看和更新​​您的信息。
  • -
  • 数据删除:请求删除您的帐户和相关数据。
  • -
  • 撤回同意:一旦获得授权,企业访问您数据的权限将被限制撤销。 -
  • -
  • 要行使这些权利,请通过 mzansi.innovation.hub@gmail.com 与我们联系。
  • -
-

-

6. 数据保留

-

我们会在提供服务所需的时间内保留您的个人数据。帐户删除后,您的数据将被永久删除,除非法律要求保留某些记录。

-

7. 本隐私政策的变更

-

我们可能会更新本隐私政策,以反映我们实践或法律要求的变化。我们将通过应用内通知和/或电子邮件通知您重大更新。

-

8. 联系我们

-

- 如果您对本隐私政策有任何疑问或疑虑,请联系我们: -

    -
  • 邮箱: mzansi.innovation.hub@gmail.com.
  • -
  • 电话: +27 655 530 195
  • -
-

- - - \ No newline at end of file diff --git a/mih_ui/web/privacy.html b/mih_ui/web/privacy.html deleted file mode 100644 index ef9479cd..00000000 --- a/mih_ui/web/privacy.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - -

Privacy Policy

- - - -

Effective Date: 6 December 2024

- Mzansi Innovation Hub - MIH ("we," "our," "us") values your privacy and is committed to protecting your personal - data. This Privacy Policy explains how we collect, use, disclose, and safeguard your information when you use - our app, Mzansi Innovation Hub - MIH, available globally. -

-

1. Information We Collect

-

- We collect the following personal information to provide and improve our services: -

    -
  • Personal Details: Name, ID, address, phone number etc.
  • -
  • Medical Information: Medical aid details (if applicable).
  • -
  • Loyalty Card Information: Loyalty card numbers for the Mzansi Wallet feature.
  • -
-

-

2. How We Use Your Information

-

- Your personal information is used for the following purposes: -

    -
  • To create and manage your account.
  • -
  • To facilitate interactions between clients and businesses.
  • -
  • To enable the storage of loyalty card information within the Mzansi Wallet.
  • -
  • To provide technical support and improve our app's functionality.
  • -
-

-

3. Data Sharing

-

- We only share your data under the following conditions: -

    -
  • With Your Consent: Businesses can access your information only with your explicit permission.
  • -
  • Legal Obligations: We may disclose information to comply with applicable laws or regulations.
  • -
-

-

4. Data Security

-

We implement advanced security measures to protect your personal data: -

    -
  • Data encryption during transmission.
  • -
  • Secure authentication protocols to prevent unauthorized access.
  • -
  • Regular audits to identify and address vulnerabilities.
  • -
-

-

5. Your Rights

-

You have the following rights regarding your personal data: -

    -
  • Access and Correction: View and update your information via your account settings.
  • -
  • Data Deletion: Request the deletion of your account and associated data.
  • -
  • Withdrawal of Consent: Revoke permissions for businesses to access your data is restricted once granted. -
  • -
  • To exercise these rights, contact us at mzansi.innovation.hub@gmail.com.
  • -
-

-

6. Data Retention

-

We retain your personal data for as long as necessary to provide our services. Upon account deletion, your data - will be permanently removed unless required by law to retain certain records.

-

7. Changes to This Privacy Policy

-

We may update this Privacy Policy to reflect changes in our practices or legal requirements. We will notify you - of significant updates via in app notifications and/ or email.

-

8. Contact Us

-

- If you have questions or concerns about this Privacy Policy, please contact us: -

    -
  • Email: mzansi.innovation.hub@gmail.com.
  • -
  • Phone: +27 655 530 195
  • -
-

- - - \ No newline at end of file diff --git a/mih_ui/web/splash/img/branding-1x.gif b/mih_ui/web/splash/img/branding-1x.gif deleted file mode 100644 index 32672774..00000000 Binary files a/mih_ui/web/splash/img/branding-1x.gif and /dev/null differ diff --git a/mih_ui/web/splash/img/branding-1x.png b/mih_ui/web/splash/img/branding-1x.png deleted file mode 100644 index c82d522c..00000000 Binary files a/mih_ui/web/splash/img/branding-1x.png and /dev/null differ diff --git a/mih_ui/web/splash/img/branding-2x.gif b/mih_ui/web/splash/img/branding-2x.gif deleted file mode 100644 index 45f9aa93..00000000 Binary files a/mih_ui/web/splash/img/branding-2x.gif and /dev/null differ diff --git a/mih_ui/web/splash/img/branding-2x.png b/mih_ui/web/splash/img/branding-2x.png deleted file mode 100644 index 7d34377d..00000000 Binary files a/mih_ui/web/splash/img/branding-2x.png and /dev/null differ diff --git a/mih_ui/web/splash/img/branding-3x.gif b/mih_ui/web/splash/img/branding-3x.gif deleted file mode 100644 index add4a9e5..00000000 Binary files a/mih_ui/web/splash/img/branding-3x.gif and /dev/null differ diff --git a/mih_ui/web/splash/img/branding-3x.png b/mih_ui/web/splash/img/branding-3x.png deleted file mode 100644 index 844f6592..00000000 Binary files a/mih_ui/web/splash/img/branding-3x.png and /dev/null differ diff --git a/mih_ui/web/splash/img/branding-4x.gif b/mih_ui/web/splash/img/branding-4x.gif deleted file mode 100644 index 2d9cc746..00000000 Binary files a/mih_ui/web/splash/img/branding-4x.gif and /dev/null differ diff --git a/mih_ui/web/splash/img/branding-4x.png b/mih_ui/web/splash/img/branding-4x.png deleted file mode 100644 index f2d86a92..00000000 Binary files a/mih_ui/web/splash/img/branding-4x.png and /dev/null differ diff --git a/mih_ui/web/splash/img/branding-dark-1x.gif b/mih_ui/web/splash/img/branding-dark-1x.gif deleted file mode 100644 index 32672774..00000000 Binary files a/mih_ui/web/splash/img/branding-dark-1x.gif and /dev/null differ diff --git a/mih_ui/web/splash/img/branding-dark-1x.png b/mih_ui/web/splash/img/branding-dark-1x.png deleted file mode 100644 index c82d522c..00000000 Binary files a/mih_ui/web/splash/img/branding-dark-1x.png and /dev/null differ diff --git a/mih_ui/web/splash/img/branding-dark-2x.gif b/mih_ui/web/splash/img/branding-dark-2x.gif deleted file mode 100644 index 45f9aa93..00000000 Binary files a/mih_ui/web/splash/img/branding-dark-2x.gif and /dev/null differ diff --git a/mih_ui/web/splash/img/branding-dark-2x.png b/mih_ui/web/splash/img/branding-dark-2x.png deleted file mode 100644 index 7d34377d..00000000 Binary files a/mih_ui/web/splash/img/branding-dark-2x.png and /dev/null differ diff --git a/mih_ui/web/splash/img/branding-dark-3x.gif b/mih_ui/web/splash/img/branding-dark-3x.gif deleted file mode 100644 index add4a9e5..00000000 Binary files a/mih_ui/web/splash/img/branding-dark-3x.gif and /dev/null differ diff --git a/mih_ui/web/splash/img/branding-dark-3x.png b/mih_ui/web/splash/img/branding-dark-3x.png deleted file mode 100644 index 844f6592..00000000 Binary files a/mih_ui/web/splash/img/branding-dark-3x.png and /dev/null differ diff --git a/mih_ui/web/splash/img/branding-dark-4x.gif b/mih_ui/web/splash/img/branding-dark-4x.gif deleted file mode 100644 index 2d9cc746..00000000 Binary files a/mih_ui/web/splash/img/branding-dark-4x.gif and /dev/null differ diff --git a/mih_ui/web/splash/img/branding-dark-4x.png b/mih_ui/web/splash/img/branding-dark-4x.png deleted file mode 100644 index f2d86a92..00000000 Binary files a/mih_ui/web/splash/img/branding-dark-4x.png and /dev/null differ diff --git a/mih_ui/web/splash/img/dark-1x.gif b/mih_ui/web/splash/img/dark-1x.gif deleted file mode 100644 index 486e4cc6..00000000 Binary files a/mih_ui/web/splash/img/dark-1x.gif and /dev/null differ diff --git a/mih_ui/web/splash/img/dark-1x.png b/mih_ui/web/splash/img/dark-1x.png deleted file mode 100644 index 53e4ced6..00000000 Binary files a/mih_ui/web/splash/img/dark-1x.png and /dev/null differ diff --git a/mih_ui/web/splash/img/dark-2x.gif b/mih_ui/web/splash/img/dark-2x.gif deleted file mode 100644 index 9326ba3d..00000000 Binary files a/mih_ui/web/splash/img/dark-2x.gif and /dev/null differ diff --git a/mih_ui/web/splash/img/dark-2x.png b/mih_ui/web/splash/img/dark-2x.png deleted file mode 100644 index 5071f829..00000000 Binary files a/mih_ui/web/splash/img/dark-2x.png and /dev/null differ diff --git a/mih_ui/web/splash/img/dark-3x.gif b/mih_ui/web/splash/img/dark-3x.gif deleted file mode 100644 index 4bbeba9c..00000000 Binary files a/mih_ui/web/splash/img/dark-3x.gif and /dev/null differ diff --git a/mih_ui/web/splash/img/dark-3x.png b/mih_ui/web/splash/img/dark-3x.png deleted file mode 100644 index c198ddbf..00000000 Binary files a/mih_ui/web/splash/img/dark-3x.png and /dev/null differ diff --git a/mih_ui/web/splash/img/dark-4x.gif b/mih_ui/web/splash/img/dark-4x.gif deleted file mode 100644 index c617e488..00000000 Binary files a/mih_ui/web/splash/img/dark-4x.gif and /dev/null differ diff --git a/mih_ui/web/splash/img/dark-4x.png b/mih_ui/web/splash/img/dark-4x.png deleted file mode 100644 index a2709e12..00000000 Binary files a/mih_ui/web/splash/img/dark-4x.png and /dev/null differ diff --git a/mih_ui/web/splash/img/light-1x.gif b/mih_ui/web/splash/img/light-1x.gif deleted file mode 100644 index 486e4cc6..00000000 Binary files a/mih_ui/web/splash/img/light-1x.gif and /dev/null differ diff --git a/mih_ui/web/splash/img/light-1x.png b/mih_ui/web/splash/img/light-1x.png deleted file mode 100644 index 53e4ced6..00000000 Binary files a/mih_ui/web/splash/img/light-1x.png and /dev/null differ diff --git a/mih_ui/web/splash/img/light-2x.gif b/mih_ui/web/splash/img/light-2x.gif deleted file mode 100644 index 9326ba3d..00000000 Binary files a/mih_ui/web/splash/img/light-2x.gif and /dev/null differ diff --git a/mih_ui/web/splash/img/light-2x.png b/mih_ui/web/splash/img/light-2x.png deleted file mode 100644 index 5071f829..00000000 Binary files a/mih_ui/web/splash/img/light-2x.png and /dev/null differ diff --git a/mih_ui/web/splash/img/light-3x.gif b/mih_ui/web/splash/img/light-3x.gif deleted file mode 100644 index 4bbeba9c..00000000 Binary files a/mih_ui/web/splash/img/light-3x.gif and /dev/null differ diff --git a/mih_ui/web/splash/img/light-3x.png b/mih_ui/web/splash/img/light-3x.png deleted file mode 100644 index c198ddbf..00000000 Binary files a/mih_ui/web/splash/img/light-3x.png and /dev/null differ diff --git a/mih_ui/web/splash/img/light-4x.gif b/mih_ui/web/splash/img/light-4x.gif deleted file mode 100644 index c617e488..00000000 Binary files a/mih_ui/web/splash/img/light-4x.gif and /dev/null differ diff --git a/mih_ui/web/splash/img/light-4x.png b/mih_ui/web/splash/img/light-4x.png deleted file mode 100644 index a2709e12..00000000 Binary files a/mih_ui/web/splash/img/light-4x.png and /dev/null differ diff --git a/mih_ui/web/wallpaper.png b/mih_ui/web/wallpaper.png deleted file mode 100644 index 32eb34ae..00000000 Binary files a/mih_ui/web/wallpaper.png and /dev/null differ diff --git a/mih_ui/windows/.gitignore b/mih_ui/windows/.gitignore deleted file mode 100644 index d492d0d9..00000000 --- a/mih_ui/windows/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -flutter/ephemeral/ - -# Visual Studio user-specific files. -*.suo -*.user -*.userosscache -*.sln.docstates - -# Visual Studio build-related files. -x64/ -x86/ - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ diff --git a/mih_ui/windows/CMakeLists.txt b/mih_ui/windows/CMakeLists.txt deleted file mode 100644 index 38cf5f42..00000000 --- a/mih_ui/windows/CMakeLists.txt +++ /dev/null @@ -1,108 +0,0 @@ -# Project-level configuration. -cmake_minimum_required(VERSION 3.14) -project(patient_manager LANGUAGES CXX) - -# The name of the executable created for the application. Change this to change -# the on-disk name of your application. -set(BINARY_NAME "patient_manager") - -# Explicitly opt in to modern CMake behaviors to avoid warnings with recent -# versions of CMake. -cmake_policy(VERSION 3.14...3.25) - -# Define build configuration option. -get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(IS_MULTICONFIG) - set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" - CACHE STRING "" FORCE) -else() - if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - set(CMAKE_BUILD_TYPE "Debug" CACHE - STRING "Flutter build mode" FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS - "Debug" "Profile" "Release") - endif() -endif() -# Define settings for the Profile build mode. -set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") -set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") -set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") -set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") - -# Use Unicode for all projects. -add_definitions(-DUNICODE -D_UNICODE) - -# Compilation settings that should be applied to most targets. -# -# Be cautious about adding new options here, as plugins use this function by -# default. In most cases, you should add new options to specific targets instead -# of modifying this function. -function(APPLY_STANDARD_SETTINGS TARGET) - target_compile_features(${TARGET} PUBLIC cxx_std_17) - target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") - target_compile_options(${TARGET} PRIVATE /EHsc) - target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") - target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") -endfunction() - -# Flutter library and tool build rules. -set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") -add_subdirectory(${FLUTTER_MANAGED_DIR}) - -# Application build; see runner/CMakeLists.txt. -add_subdirectory("runner") - - -# Generated plugin build rules, which manage building the plugins and adding -# them to the application. -include(flutter/generated_plugins.cmake) - - -# === Installation === -# Support files are copied into place next to the executable, so that it can -# run in place. This is done instead of making a separate bundle (as on Linux) -# so that building and running from within Visual Studio will work. -set(BUILD_BUNDLE_DIR "$") -# Make the "install" step default, as it's required to run. -set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) -endif() - -set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") -set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") - -install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" - COMPONENT Runtime) - -install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" - COMPONENT Runtime) - -install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) - -if(PLUGIN_BUNDLED_LIBRARIES) - install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" - DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) -endif() - -# Copy the native assets provided by the build.dart from all packages. -set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") -install(DIRECTORY "${NATIVE_ASSETS_DIR}" - DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) - -# Fully re-copy the assets directory on each build to avoid having stale files -# from a previous install. -set(FLUTTER_ASSET_DIR_NAME "flutter_assets") -install(CODE " - file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") - " COMPONENT Runtime) -install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" - DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) - -# Install the AOT library on non-Debug builds only. -install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" - CONFIGURATIONS Profile;Release - COMPONENT Runtime) diff --git a/mih_ui/windows/flutter/CMakeLists.txt b/mih_ui/windows/flutter/CMakeLists.txt deleted file mode 100644 index 903f4899..00000000 --- a/mih_ui/windows/flutter/CMakeLists.txt +++ /dev/null @@ -1,109 +0,0 @@ -# This file controls Flutter-level build steps. It should not be edited. -cmake_minimum_required(VERSION 3.14) - -set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") - -# Configuration provided via flutter tool. -include(${EPHEMERAL_DIR}/generated_config.cmake) - -# TODO: Move the rest of this into files in ephemeral. See -# https://github.com/flutter/flutter/issues/57146. -set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") - -# Set fallback configurations for older versions of the flutter tool. -if (NOT DEFINED FLUTTER_TARGET_PLATFORM) - set(FLUTTER_TARGET_PLATFORM "windows-x64") -endif() - -# === Flutter Library === -set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") - -# Published to parent scope for install step. -set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) -set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) -set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) -set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) - -list(APPEND FLUTTER_LIBRARY_HEADERS - "flutter_export.h" - "flutter_windows.h" - "flutter_messenger.h" - "flutter_plugin_registrar.h" - "flutter_texture_registrar.h" -) -list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") -add_library(flutter INTERFACE) -target_include_directories(flutter INTERFACE - "${EPHEMERAL_DIR}" -) -target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") -add_dependencies(flutter flutter_assemble) - -# === Wrapper === -list(APPEND CPP_WRAPPER_SOURCES_CORE - "core_implementations.cc" - "standard_codec.cc" -) -list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") -list(APPEND CPP_WRAPPER_SOURCES_PLUGIN - "plugin_registrar.cc" -) -list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") -list(APPEND CPP_WRAPPER_SOURCES_APP - "flutter_engine.cc" - "flutter_view_controller.cc" -) -list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") - -# Wrapper sources needed for a plugin. -add_library(flutter_wrapper_plugin STATIC - ${CPP_WRAPPER_SOURCES_CORE} - ${CPP_WRAPPER_SOURCES_PLUGIN} -) -apply_standard_settings(flutter_wrapper_plugin) -set_target_properties(flutter_wrapper_plugin PROPERTIES - POSITION_INDEPENDENT_CODE ON) -set_target_properties(flutter_wrapper_plugin PROPERTIES - CXX_VISIBILITY_PRESET hidden) -target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) -target_include_directories(flutter_wrapper_plugin PUBLIC - "${WRAPPER_ROOT}/include" -) -add_dependencies(flutter_wrapper_plugin flutter_assemble) - -# Wrapper sources needed for the runner. -add_library(flutter_wrapper_app STATIC - ${CPP_WRAPPER_SOURCES_CORE} - ${CPP_WRAPPER_SOURCES_APP} -) -apply_standard_settings(flutter_wrapper_app) -target_link_libraries(flutter_wrapper_app PUBLIC flutter) -target_include_directories(flutter_wrapper_app PUBLIC - "${WRAPPER_ROOT}/include" -) -add_dependencies(flutter_wrapper_app flutter_assemble) - -# === Flutter tool backend === -# _phony_ is a non-existent file to force this command to run every time, -# since currently there's no way to get a full input/output list from the -# flutter tool. -set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") -set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) -add_custom_command( - OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} - ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} - ${CPP_WRAPPER_SOURCES_APP} - ${PHONY_OUTPUT} - COMMAND ${CMAKE_COMMAND} -E env - ${FLUTTER_TOOL_ENVIRONMENT} - "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" - ${FLUTTER_TARGET_PLATFORM} $ - VERBATIM -) -add_custom_target(flutter_assemble DEPENDS - "${FLUTTER_LIBRARY}" - ${FLUTTER_LIBRARY_HEADERS} - ${CPP_WRAPPER_SOURCES_CORE} - ${CPP_WRAPPER_SOURCES_PLUGIN} - ${CPP_WRAPPER_SOURCES_APP} -) diff --git a/mih_ui/windows/flutter/generated_plugin_registrant.cc b/mih_ui/windows/flutter/generated_plugin_registrant.cc deleted file mode 100644 index ad71ace9..00000000 --- a/mih_ui/windows/flutter/generated_plugin_registrant.cc +++ /dev/null @@ -1,53 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#include "generated_plugin_registrant.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -void RegisterPlugins(flutter::PluginRegistry* registry) { - FileSaverPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("FileSaverPlugin")); - FileSelectorWindowsRegisterWithRegistrar( - registry->GetRegistrarForPlugin("FileSelectorWindows")); - FirebaseAuthPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("FirebaseAuthPluginCApi")); - FirebaseCorePluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); - FlDownloaderPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("FlDownloaderPluginCApi")); - FlutterTtsPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("FlutterTtsPlugin")); - GeolocatorWindowsRegisterWithRegistrar( - registry->GetRegistrarForPlugin("GeolocatorWindows")); - LocalAuthPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("LocalAuthPlugin")); - PrintingPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("PrintingPlugin")); - RecordWindowsPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("RecordWindowsPluginCApi")); - ScreenBrightnessWindowsPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("ScreenBrightnessWindowsPlugin")); - SharePlusWindowsPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); - SyncfusionPdfviewerWindowsPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("SyncfusionPdfviewerWindowsPlugin")); - UrlLauncherWindowsRegisterWithRegistrar( - registry->GetRegistrarForPlugin("UrlLauncherWindows")); -} diff --git a/mih_ui/windows/flutter/generated_plugin_registrant.h b/mih_ui/windows/flutter/generated_plugin_registrant.h deleted file mode 100644 index dc139d85..00000000 --- a/mih_ui/windows/flutter/generated_plugin_registrant.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#ifndef GENERATED_PLUGIN_REGISTRANT_ -#define GENERATED_PLUGIN_REGISTRANT_ - -#include - -// Registers Flutter plugins. -void RegisterPlugins(flutter::PluginRegistry* registry); - -#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/mih_ui/windows/flutter/generated_plugins.cmake b/mih_ui/windows/flutter/generated_plugins.cmake deleted file mode 100644 index 57f48306..00000000 --- a/mih_ui/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,37 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - file_saver - file_selector_windows - firebase_auth - firebase_core - fl_downloader - flutter_tts - geolocator_windows - local_auth_windows - printing - record_windows - screen_brightness_windows - share_plus - syncfusion_pdfviewer_windows - url_launcher_windows -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/mih_ui/windows/runner/CMakeLists.txt b/mih_ui/windows/runner/CMakeLists.txt deleted file mode 100644 index 394917c0..00000000 --- a/mih_ui/windows/runner/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -cmake_minimum_required(VERSION 3.14) -project(runner LANGUAGES CXX) - -# Define the application target. To change its name, change BINARY_NAME in the -# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer -# work. -# -# Any new source files that you add to the application should be added here. -add_executable(${BINARY_NAME} WIN32 - "flutter_window.cpp" - "main.cpp" - "utils.cpp" - "win32_window.cpp" - "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" - "Runner.rc" - "runner.exe.manifest" -) - -# Apply the standard set of build settings. This can be removed for applications -# that need different build settings. -apply_standard_settings(${BINARY_NAME}) - -# Add preprocessor definitions for the build version. -target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") -target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") -target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") -target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") -target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") - -# Disable Windows macros that collide with C++ standard library functions. -target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") - -# Add dependency libraries and include directories. Add any application-specific -# dependencies here. -target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) -target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") -target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") - -# Run the Flutter tool portions of the build. This must not be removed. -add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/mih_ui/windows/runner/Runner.rc b/mih_ui/windows/runner/Runner.rc deleted file mode 100644 index 2d183071..00000000 --- a/mih_ui/windows/runner/Runner.rc +++ /dev/null @@ -1,121 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#pragma code_page(65001) -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_APP_ICON ICON "resources\\app_icon.ico" - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) -#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD -#else -#define VERSION_AS_NUMBER 1,0,0,0 -#endif - -#if defined(FLUTTER_VERSION) -#define VERSION_AS_STRING FLUTTER_VERSION -#else -#define VERSION_AS_STRING "1.0.0" -#endif - -VS_VERSION_INFO VERSIONINFO - FILEVERSION VERSION_AS_NUMBER - PRODUCTVERSION VERSION_AS_NUMBER - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0x0L -#endif - FILEOS VOS__WINDOWS32 - FILETYPE VFT_APP - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "com.example" "\0" - VALUE "FileDescription", "patient_manager" "\0" - VALUE "FileVersion", VERSION_AS_STRING "\0" - VALUE "InternalName", "patient_manager" "\0" - VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" - VALUE "OriginalFilename", "patient_manager.exe" "\0" - VALUE "ProductName", "patient_manager" "\0" - VALUE "ProductVersion", VERSION_AS_STRING "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED diff --git a/mih_ui/windows/runner/flutter_window.cpp b/mih_ui/windows/runner/flutter_window.cpp deleted file mode 100644 index 955ee303..00000000 --- a/mih_ui/windows/runner/flutter_window.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "flutter_window.h" - -#include - -#include "flutter/generated_plugin_registrant.h" - -FlutterWindow::FlutterWindow(const flutter::DartProject& project) - : project_(project) {} - -FlutterWindow::~FlutterWindow() {} - -bool FlutterWindow::OnCreate() { - if (!Win32Window::OnCreate()) { - return false; - } - - RECT frame = GetClientArea(); - - // The size here must match the window dimensions to avoid unnecessary surface - // creation / destruction in the startup path. - flutter_controller_ = std::make_unique( - frame.right - frame.left, frame.bottom - frame.top, project_); - // Ensure that basic setup of the controller was successful. - if (!flutter_controller_->engine() || !flutter_controller_->view()) { - return false; - } - RegisterPlugins(flutter_controller_->engine()); - SetChildContent(flutter_controller_->view()->GetNativeWindow()); - - flutter_controller_->engine()->SetNextFrameCallback([&]() { - this->Show(); - }); - - // Flutter can complete the first frame before the "show window" callback is - // registered. The following call ensures a frame is pending to ensure the - // window is shown. It is a no-op if the first frame hasn't completed yet. - flutter_controller_->ForceRedraw(); - - return true; -} - -void FlutterWindow::OnDestroy() { - if (flutter_controller_) { - flutter_controller_ = nullptr; - } - - Win32Window::OnDestroy(); -} - -LRESULT -FlutterWindow::MessageHandler(HWND hwnd, UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept { - // Give Flutter, including plugins, an opportunity to handle window messages. - if (flutter_controller_) { - std::optional result = - flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, - lparam); - if (result) { - return *result; - } - } - - switch (message) { - case WM_FONTCHANGE: - flutter_controller_->engine()->ReloadSystemFonts(); - break; - } - - return Win32Window::MessageHandler(hwnd, message, wparam, lparam); -} diff --git a/mih_ui/windows/runner/flutter_window.h b/mih_ui/windows/runner/flutter_window.h deleted file mode 100644 index 6da0652f..00000000 --- a/mih_ui/windows/runner/flutter_window.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef RUNNER_FLUTTER_WINDOW_H_ -#define RUNNER_FLUTTER_WINDOW_H_ - -#include -#include - -#include - -#include "win32_window.h" - -// A window that does nothing but host a Flutter view. -class FlutterWindow : public Win32Window { - public: - // Creates a new FlutterWindow hosting a Flutter view running |project|. - explicit FlutterWindow(const flutter::DartProject& project); - virtual ~FlutterWindow(); - - protected: - // Win32Window: - bool OnCreate() override; - void OnDestroy() override; - LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, - LPARAM const lparam) noexcept override; - - private: - // The project to run. - flutter::DartProject project_; - - // The Flutter instance hosted by this window. - std::unique_ptr flutter_controller_; -}; - -#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/mih_ui/windows/runner/main.cpp b/mih_ui/windows/runner/main.cpp deleted file mode 100644 index 61a4b0ea..00000000 --- a/mih_ui/windows/runner/main.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include - -#include "flutter_window.h" -#include "utils.h" - -int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, - _In_ wchar_t *command_line, _In_ int show_command) { - // Attach to console when present (e.g., 'flutter run') or create a - // new console when running with a debugger. - if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { - CreateAndAttachConsole(); - } - - // Initialize COM, so that it is available for use in the library and/or - // plugins. - ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); - - flutter::DartProject project(L"data"); - - std::vector command_line_arguments = - GetCommandLineArguments(); - - project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); - - FlutterWindow window(project); - Win32Window::Point origin(10, 10); - Win32Window::Size size(1280, 720); - if (!window.Create(L"patient_manager", origin, size)) { - return EXIT_FAILURE; - } - window.SetQuitOnClose(true); - - ::MSG msg; - while (::GetMessage(&msg, nullptr, 0, 0)) { - ::TranslateMessage(&msg); - ::DispatchMessage(&msg); - } - - ::CoUninitialize(); - return EXIT_SUCCESS; -} diff --git a/mih_ui/windows/runner/resource.h b/mih_ui/windows/runner/resource.h deleted file mode 100644 index 66a65d1e..00000000 --- a/mih_ui/windows/runner/resource.h +++ /dev/null @@ -1,16 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by Runner.rc -// -#define IDI_APP_ICON 101 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/mih_ui/windows/runner/resources/app_icon.ico b/mih_ui/windows/runner/resources/app_icon.ico deleted file mode 100644 index af93bd81..00000000 Binary files a/mih_ui/windows/runner/resources/app_icon.ico and /dev/null differ diff --git a/mih_ui/windows/runner/runner.exe.manifest b/mih_ui/windows/runner/runner.exe.manifest deleted file mode 100644 index a42ea768..00000000 --- a/mih_ui/windows/runner/runner.exe.manifest +++ /dev/null @@ -1,20 +0,0 @@ - - - - - PerMonitorV2 - - - - - - - - - - - - - - - diff --git a/mih_ui/windows/runner/utils.cpp b/mih_ui/windows/runner/utils.cpp deleted file mode 100644 index b2b08734..00000000 --- a/mih_ui/windows/runner/utils.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "utils.h" - -#include -#include -#include -#include - -#include - -void CreateAndAttachConsole() { - if (::AllocConsole()) { - FILE *unused; - if (freopen_s(&unused, "CONOUT$", "w", stdout)) { - _dup2(_fileno(stdout), 1); - } - if (freopen_s(&unused, "CONOUT$", "w", stderr)) { - _dup2(_fileno(stdout), 2); - } - std::ios::sync_with_stdio(); - FlutterDesktopResyncOutputStreams(); - } -} - -std::vector GetCommandLineArguments() { - // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. - int argc; - wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); - if (argv == nullptr) { - return std::vector(); - } - - std::vector command_line_arguments; - - // Skip the first argument as it's the binary name. - for (int i = 1; i < argc; i++) { - command_line_arguments.push_back(Utf8FromUtf16(argv[i])); - } - - ::LocalFree(argv); - - return command_line_arguments; -} - -std::string Utf8FromUtf16(const wchar_t* utf16_string) { - if (utf16_string == nullptr) { - return std::string(); - } - int target_length = ::WideCharToMultiByte( - CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, - -1, nullptr, 0, nullptr, nullptr) - -1; // remove the trailing null character - int input_length = (int)wcslen(utf16_string); - std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { - return utf8_string; - } - utf8_string.resize(target_length); - int converted_length = ::WideCharToMultiByte( - CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, - input_length, utf8_string.data(), target_length, nullptr, nullptr); - if (converted_length == 0) { - return std::string(); - } - return utf8_string; -} diff --git a/mih_ui/windows/runner/utils.h b/mih_ui/windows/runner/utils.h deleted file mode 100644 index 3879d547..00000000 --- a/mih_ui/windows/runner/utils.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef RUNNER_UTILS_H_ -#define RUNNER_UTILS_H_ - -#include -#include - -// Creates a console for the process, and redirects stdout and stderr to -// it for both the runner and the Flutter library. -void CreateAndAttachConsole(); - -// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string -// encoded in UTF-8. Returns an empty std::string on failure. -std::string Utf8FromUtf16(const wchar_t* utf16_string); - -// Gets the command line arguments passed in as a std::vector, -// encoded in UTF-8. Returns an empty std::vector on failure. -std::vector GetCommandLineArguments(); - -#endif // RUNNER_UTILS_H_ diff --git a/mih_ui/windows/runner/win32_window.cpp b/mih_ui/windows/runner/win32_window.cpp deleted file mode 100644 index 60608d0f..00000000 --- a/mih_ui/windows/runner/win32_window.cpp +++ /dev/null @@ -1,288 +0,0 @@ -#include "win32_window.h" - -#include -#include - -#include "resource.h" - -namespace { - -/// Window attribute that enables dark mode window decorations. -/// -/// Redefined in case the developer's machine has a Windows SDK older than -/// version 10.0.22000.0. -/// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute -#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE -#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 -#endif - -constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; - -/// Registry key for app theme preference. -/// -/// A value of 0 indicates apps should use dark mode. A non-zero or missing -/// value indicates apps should use light mode. -constexpr const wchar_t kGetPreferredBrightnessRegKey[] = - L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; -constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; - -// The number of Win32Window objects that currently exist. -static int g_active_window_count = 0; - -using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); - -// Scale helper to convert logical scaler values to physical using passed in -// scale factor -int Scale(int source, double scale_factor) { - return static_cast(source * scale_factor); -} - -// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. -// This API is only needed for PerMonitor V1 awareness mode. -void EnableFullDpiSupportIfAvailable(HWND hwnd) { - HMODULE user32_module = LoadLibraryA("User32.dll"); - if (!user32_module) { - return; - } - auto enable_non_client_dpi_scaling = - reinterpret_cast( - GetProcAddress(user32_module, "EnableNonClientDpiScaling")); - if (enable_non_client_dpi_scaling != nullptr) { - enable_non_client_dpi_scaling(hwnd); - } - FreeLibrary(user32_module); -} - -} // namespace - -// Manages the Win32Window's window class registration. -class WindowClassRegistrar { - public: - ~WindowClassRegistrar() = default; - - // Returns the singleton registrar instance. - static WindowClassRegistrar* GetInstance() { - if (!instance_) { - instance_ = new WindowClassRegistrar(); - } - return instance_; - } - - // Returns the name of the window class, registering the class if it hasn't - // previously been registered. - const wchar_t* GetWindowClass(); - - // Unregisters the window class. Should only be called if there are no - // instances of the window. - void UnregisterWindowClass(); - - private: - WindowClassRegistrar() = default; - - static WindowClassRegistrar* instance_; - - bool class_registered_ = false; -}; - -WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; - -const wchar_t* WindowClassRegistrar::GetWindowClass() { - if (!class_registered_) { - WNDCLASS window_class{}; - window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); - window_class.lpszClassName = kWindowClassName; - window_class.style = CS_HREDRAW | CS_VREDRAW; - window_class.cbClsExtra = 0; - window_class.cbWndExtra = 0; - window_class.hInstance = GetModuleHandle(nullptr); - window_class.hIcon = - LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); - window_class.hbrBackground = 0; - window_class.lpszMenuName = nullptr; - window_class.lpfnWndProc = Win32Window::WndProc; - RegisterClass(&window_class); - class_registered_ = true; - } - return kWindowClassName; -} - -void WindowClassRegistrar::UnregisterWindowClass() { - UnregisterClass(kWindowClassName, nullptr); - class_registered_ = false; -} - -Win32Window::Win32Window() { - ++g_active_window_count; -} - -Win32Window::~Win32Window() { - --g_active_window_count; - Destroy(); -} - -bool Win32Window::Create(const std::wstring& title, - const Point& origin, - const Size& size) { - Destroy(); - - const wchar_t* window_class = - WindowClassRegistrar::GetInstance()->GetWindowClass(); - - const POINT target_point = {static_cast(origin.x), - static_cast(origin.y)}; - HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); - UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); - double scale_factor = dpi / 96.0; - - HWND window = CreateWindow( - window_class, title.c_str(), WS_OVERLAPPEDWINDOW, - Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), - Scale(size.width, scale_factor), Scale(size.height, scale_factor), - nullptr, nullptr, GetModuleHandle(nullptr), this); - - if (!window) { - return false; - } - - UpdateTheme(window); - - return OnCreate(); -} - -bool Win32Window::Show() { - return ShowWindow(window_handle_, SW_SHOWNORMAL); -} - -// static -LRESULT CALLBACK Win32Window::WndProc(HWND const window, - UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept { - if (message == WM_NCCREATE) { - auto window_struct = reinterpret_cast(lparam); - SetWindowLongPtr(window, GWLP_USERDATA, - reinterpret_cast(window_struct->lpCreateParams)); - - auto that = static_cast(window_struct->lpCreateParams); - EnableFullDpiSupportIfAvailable(window); - that->window_handle_ = window; - } else if (Win32Window* that = GetThisFromHandle(window)) { - return that->MessageHandler(window, message, wparam, lparam); - } - - return DefWindowProc(window, message, wparam, lparam); -} - -LRESULT -Win32Window::MessageHandler(HWND hwnd, - UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept { - switch (message) { - case WM_DESTROY: - window_handle_ = nullptr; - Destroy(); - if (quit_on_close_) { - PostQuitMessage(0); - } - return 0; - - case WM_DPICHANGED: { - auto newRectSize = reinterpret_cast(lparam); - LONG newWidth = newRectSize->right - newRectSize->left; - LONG newHeight = newRectSize->bottom - newRectSize->top; - - SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, - newHeight, SWP_NOZORDER | SWP_NOACTIVATE); - - return 0; - } - case WM_SIZE: { - RECT rect = GetClientArea(); - if (child_content_ != nullptr) { - // Size and position the child window. - MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, - rect.bottom - rect.top, TRUE); - } - return 0; - } - - case WM_ACTIVATE: - if (child_content_ != nullptr) { - SetFocus(child_content_); - } - return 0; - - case WM_DWMCOLORIZATIONCOLORCHANGED: - UpdateTheme(hwnd); - return 0; - } - - return DefWindowProc(window_handle_, message, wparam, lparam); -} - -void Win32Window::Destroy() { - OnDestroy(); - - if (window_handle_) { - DestroyWindow(window_handle_); - window_handle_ = nullptr; - } - if (g_active_window_count == 0) { - WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); - } -} - -Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { - return reinterpret_cast( - GetWindowLongPtr(window, GWLP_USERDATA)); -} - -void Win32Window::SetChildContent(HWND content) { - child_content_ = content; - SetParent(content, window_handle_); - RECT frame = GetClientArea(); - - MoveWindow(content, frame.left, frame.top, frame.right - frame.left, - frame.bottom - frame.top, true); - - SetFocus(child_content_); -} - -RECT Win32Window::GetClientArea() { - RECT frame; - GetClientRect(window_handle_, &frame); - return frame; -} - -HWND Win32Window::GetHandle() { - return window_handle_; -} - -void Win32Window::SetQuitOnClose(bool quit_on_close) { - quit_on_close_ = quit_on_close; -} - -bool Win32Window::OnCreate() { - // No-op; provided for subclasses. - return true; -} - -void Win32Window::OnDestroy() { - // No-op; provided for subclasses. -} - -void Win32Window::UpdateTheme(HWND const window) { - DWORD light_mode; - DWORD light_mode_size = sizeof(light_mode); - LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, - kGetPreferredBrightnessRegValue, - RRF_RT_REG_DWORD, nullptr, &light_mode, - &light_mode_size); - - if (result == ERROR_SUCCESS) { - BOOL enable_dark_mode = light_mode == 0; - DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, - &enable_dark_mode, sizeof(enable_dark_mode)); - } -} diff --git a/mih_ui/windows/runner/win32_window.h b/mih_ui/windows/runner/win32_window.h deleted file mode 100644 index e901dde6..00000000 --- a/mih_ui/windows/runner/win32_window.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef RUNNER_WIN32_WINDOW_H_ -#define RUNNER_WIN32_WINDOW_H_ - -#include - -#include -#include -#include - -// A class abstraction for a high DPI-aware Win32 Window. Intended to be -// inherited from by classes that wish to specialize with custom -// rendering and input handling -class Win32Window { - public: - struct Point { - unsigned int x; - unsigned int y; - Point(unsigned int x, unsigned int y) : x(x), y(y) {} - }; - - struct Size { - unsigned int width; - unsigned int height; - Size(unsigned int width, unsigned int height) - : width(width), height(height) {} - }; - - Win32Window(); - virtual ~Win32Window(); - - // Creates a win32 window with |title| that is positioned and sized using - // |origin| and |size|. New windows are created on the default monitor. Window - // sizes are specified to the OS in physical pixels, hence to ensure a - // consistent size this function will scale the inputted width and height as - // as appropriate for the default monitor. The window is invisible until - // |Show| is called. Returns true if the window was created successfully. - bool Create(const std::wstring& title, const Point& origin, const Size& size); - - // Show the current window. Returns true if the window was successfully shown. - bool Show(); - - // Release OS resources associated with window. - void Destroy(); - - // Inserts |content| into the window tree. - void SetChildContent(HWND content); - - // Returns the backing Window handle to enable clients to set icon and other - // window properties. Returns nullptr if the window has been destroyed. - HWND GetHandle(); - - // If true, closing this window will quit the application. - void SetQuitOnClose(bool quit_on_close); - - // Return a RECT representing the bounds of the current client area. - RECT GetClientArea(); - - protected: - // Processes and route salient window messages for mouse handling, - // size change and DPI. Delegates handling of these to member overloads that - // inheriting classes can handle. - virtual LRESULT MessageHandler(HWND window, - UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept; - - // Called when CreateAndShow is called, allowing subclass window-related - // setup. Subclasses should return false if setup fails. - virtual bool OnCreate(); - - // Called when Destroy is called. - virtual void OnDestroy(); - - private: - friend class WindowClassRegistrar; - - // OS callback called by message pump. Handles the WM_NCCREATE message which - // is passed when the non-client area is being created and enables automatic - // non-client DPI scaling so that the non-client area automatically - // responds to changes in DPI. All other messages are handled by - // MessageHandler. - static LRESULT CALLBACK WndProc(HWND const window, - UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept; - - // Retrieves a class instance pointer for |window| - static Win32Window* GetThisFromHandle(HWND const window) noexcept; - - // Update the window frame's theme to match the system theme. - static void UpdateTheme(HWND const window); - - bool quit_on_close_ = false; - - // window handle for top level window. - HWND window_handle_ = nullptr; - - // window handle for hosted content. - HWND child_content_ = nullptr; -}; - -#endif // RUNNER_WIN32_WINDOW_H_