It is common for a nail to turn black after an injury
. The black or purple-black color is caused by blood under the nail and will go away as the injury heals. It is surprising to take so long. The nail should have been protected well with caps to fasten the healing.
Black, brown, or purple discoloration under a nail that has not been injured may be caused by melanoma
. it seems the nail bed is also not healed well. We can surgically explore the area and graft to reconstruct the nail bed and restore the blood supply. We also need to checck the blood supply to the nail bed if the graft reconstruction works.
If the nail detaches from the nail bed then it is impossible to restore it. The nail grows from the germinal matrix ( the crescent shaped think from which the nail grows). If that is not damaged we can expect the nail to grow in an year properly attaching to the nail bed.
Consult a Dermatosurgeon in your area.