A single apartment complex could almost certainly not cover enough space with solar panels in order to charge a battery to accommodate this.
In fact, trying to 100% charge the batteries via solar would not be the most economical way to operate as then you are just wasting money sending power back to the grid.