The small midge like insects are sciarid flies, and the maggots eating your plant roots are their larvae.
The insects can be killed by lightly spraying the compost surface with a suitable insecticide, and the maggots will need a form of
biological control, e.g. nematodes.