Project Title: SLR Team Management App

The SLR Team Management App is an Android-based application designed to streamline workforce scheduling, time tracking, and task management for team leaders and employees. Built with Kotlin and integrated with Firebase services, the app provides a comprehensive tool for managing day-to-day operations in a team environment.

Key features include:

•	User Authentication: Powered by Firebase Authentication, users can securely log in to access their respective dashboards. Role-based access ensures managers and employees have tailored interfaces.
•	Scheduling: Managers can create and assign shifts to employees, while employees can view their schedules. The app includes a shift swap feature handled through Firebase Cloud Functions.
•	Time Clock: Employees can clock in and out based on their location using GPS, with data recorded in Firestore for accurate time tracking.
•	Task Management: Tasks can be assigned to specific employees with role-based access control, ensuring only relevant personnel can view and complete tasks.
•	Reports: Managers can generate weekly reports for total hours worked, employee performance, and labor costs.
•	Payroll: Integration with payroll management to calculate wages based on hours worked and shifts assigned.

The app uses:

•	Firebase Firestore for real-time data storage,
•	Firebase Functions for cloud-based shift swaps and other server-side logic,
•	Coroutines for asynchronous programming and handling network tasks smoothly.

This project provides an all-in-one solution for managing small to medium-sized teams, improving operational efficiency and communication within teams.

Package Name :- com.example.slrteammanagement

Main Activity.kt

package com.example.slrteammanagement

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController
import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.setupActionBarWithNavController
import androidx.navigation.ui.setupWithNavController
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.google.firebase.auth.FirebaseAuth
import android.content.Intent

class MainActivity : AppCompatActivity() {
    private lateinit var auth: FirebaseAuth

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        auth = FirebaseAuth.getInstance()

        if (auth.currentUser == null) {
            startActivity(Intent(this, LoginActivity::class.java))
            finish()
            return
        }

        val navView: BottomNavigationView = findViewById(R.id.nav_view)
        val navController = findNavController(R.id.nav_host_fragment)
        val appBarConfiguration = AppBarConfiguration(
            setOf(
                R.id.navigation_schedule, R.id.navigation_employees, R.id.navigation_tasks,
                R.id.navigation_timeclock, R.id.navigation_reports, R.id.navigation_payroll
            )
        )
        setupActionBarWithNavController(navController, appBarConfiguration)
        navView.setupWithNavController(navController)
    }
}

LoginActivity.kt

package com.example.slrteammanagement

import android.os.Bundle
import android.widget.Button
import android.widget.EditText
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.firestore.FirebaseFirestore

class LoginActivity : AppCompatActivity() {
    private lateinit var auth: FirebaseAuth
    private lateinit var db: FirebaseFirestore

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_login)

        auth = FirebaseAuth.getInstance()
        db = FirebaseFirestore.getInstance()

        val emailEditText: EditText = findViewById(R.id.emailEditText)
        val passwordEditText: EditText = findViewById(R.id.passwordEditText)
        val loginButton: Button = findViewById(R.id.loginButton)

        loginButton.setOnClickListener {
            val email = emailEditText.text.toString()
            val password = passwordEditText.text.toString()

            auth.signInWithEmailAndPassword(email, password)
                .addOnCompleteListener(this) { task ->
                    if (task.isSuccessful) {
                        checkUserRole()
                    } else {
                        Toast.makeText(baseContext, "Authentication failed.", Toast.LENGTH_SHORT).show()
                    }
                }
        }
    }

    private fun checkUserRole() {
        val user = auth.currentUser
        if (user != null) {
            db.collection("users").document(user.uid).get()
                .addOnSuccessListener { document ->
                    if (document != null) {
                        val role = document.getString("role")
                        when (role) {
                            "manager" -> startActivity(Intent(this, MainActivity::class.java))
                            "employee" -> startActivity(Intent(this, EmployeeMainActivity::class.java))
                            else -> Toast.makeText(this, "Invalid user role", Toast.LENGTH_SHORT).show()
                        }
                        finish()
                    }
                }
                .addOnFailureListener { exception ->
                    Toast.makeText(this, "Error getting user data: ${exception.message}", Toast.LENGTH_SHORT).show()
                }
        }
    }
}

ScheduleFragment.kt