Since you were after the fiqhi ruling on the issue you asked about, we saw it necessary to enquire Ayatullah Mahdi Hadavi Tehrani; this is his answer:
1- If what is being done in the job is halal and the one doing it has no certitude as to whether the pay given to him is from haram money or not [even if there is a possibility], meaning that he doesn’t know whether the money paid to him for his work is from haram money or halal money, it is permissible to accept it, and just because the employer doesn’t carry out his religious duties or commits haram acts has no impact whatsoever on this.
2- Forbidding others from haram acts, or enjoining them to do their wajib ones, is wajib because it falls under the category of amr bil ma’ruf wa nahy anil munkar, and this applies to everyone, even one’s employer. Therefore, carrying this religious duty is also wajib, given that all the conditions are met and that it certainly applies.
For further information, you can refer to: