finally have add and edit condition working