Hadith.3596 - It is reported that Commander of the Faithful عليه السلام used to go out during the midday heat for tasks that had already been taken care of, desiring that Allah سبحانه وتعالى, the Exalted, would see him exerting himself in the pursuit of lawful sustenance.
As for the earnings of a teacher, there is no harm if he takes payment for teaching poetry, letters, legal rights, and similar subjects-even if he sets a condition for payment.
However, taking payment for teaching the Quran is not permissible.