# your_app/management/commands/approve_attendance.py

from django.core.management.base import BaseCommand
from account.models import *
from account.custom_today import get_custom_today  # Adjust this import if needed

class Command(BaseCommand):
    help = 'Approve attendance summary cart for today'

    def handle(self, *args, **kwargs):
        deleted_out_of_unit_emp_count, _ = OutOfUnitEmp.objects.filter(member=None).delete()
        self.stdout.write(self.style.SUCCESS(f"{deleted_out_of_unit_emp_count} out of unit employees deleted"))

        deleted_ops_depl_count, _ = OpsDepl.objects.filter(member=None).delete()
        self.stdout.write(self.style.SUCCESS(f"{deleted_ops_depl_count} Ops depl deleted"))

        deleted_leave_count, _ = Leave.objects.filter(member=None).delete()
        self.stdout.write(self.style.SUCCESS(f"{deleted_leave_count} Leave deleted"))

        deleted_main_leave_count, _ = MainLeave.objects.filter(member=None).delete()
        self.stdout.write(self.style.SUCCESS(f"{deleted_main_leave_count} Main Leave deleted"))

        deleted_course_cdr_trg_count, _ = Course_Cdr_Trg.objects.filter(member=None).delete()
        self.stdout.write(self.style.SUCCESS(f"{deleted_course_cdr_trg_count} Course Cdr Trg deleted"))

        deleted_unauth_absent_count, _ = UnauthAbsent.objects.filter(member=None).delete()
        self.stdout.write(self.style.SUCCESS(f"{deleted_unauth_absent_count} Unauth Absent deleted"))

        deleted_other_reason_count, _ = OtherReason.objects.filter(member=None).delete()
        self.stdout.write(self.style.SUCCESS(f"{deleted_other_reason_count} Other Reason deleted"))

        deleted_movement_order_count, _ = MovementOrder.objects.filter(member=None).delete()
        self.stdout.write(self.style.SUCCESS(f"{deleted_movement_order_count} Movement Order deleted"))




