Continue up to August 2017 without resigning. Avail another one month leave for illness by producing medical certificate which you are eligible under section 10 of Maternity benefit act.. Give notice of resignation in such a way that notice period ends with additional sick leave applied under Section 10 of the Act.
Do like this and see what employer will do. You need not show any mercy...the only thing required to be eligible to avail maternity benefit is you should have worked for 80 days in 12 months preceding date of delivery. Law said nowhere if you resign while on leave you are not eligible for maternity benefits from date of resignation. When law is silent on it why you want to show mercy on employer?