#!/bin/bash

# This script allows the user to navigate a menu to carry out different functions relating to customer records.
# Patrons can be added, removed, searched and emailed from
# This menu will allow the user to select from any of the shell scripts listed.

ps -ef

x=0

while [ $x = 0 ]
do
        # Print menu to user
	clear
	echo "Covid-19 Tracing Tool Menu"
	echo
	echo "		1 - Add a new  Customer"
	echo "		2 - Remove an existing Customer"
	echo "		3 - Search for a Customer"
	echo "		4 - E-mail a Customer"
	echo "		0 - Exit..."
	echo

	# prompt user to enter a number and store it in var 'response'
	read -p "Please enter one of the numbers above:  [0-4] > " response 


	# case menu: a menu driven system for covid-19 tracing tool
	case "$response" in
		1)	source /home/compsys/Covid-19_Contact_Log_Tracing/addContact.sh
			#bash addContact.sh
			#./addContact.sh
			x=1
			;;
		2)	./remove.sh
			#echo "you have chosen 2."
	                x=1
			;;
		3)	./searchCust.sh
	                x=1
			;;
		4)	#./email
			echo "you have chosen 4."
	                x=1
			;;
		0)	echo "Exiting..."
	                x=1
			sleep 2
			exit 0
	                ;;
	        *)      clear #clear the terminal screen
	                echo "Invalid input, that is not an option"
	                sleep 1
			clear
			echo "please choose a option between [0-4]"
	                ;;
	esac

done
