1999 Nissan Pathfinder

My car started got 2feet and it just cut off on me ,tried to restart would not turn over and no panel lights ,called roadside they came for battery recharge still nothing (battery is one year old,brand new),still no start ,sat awhile turned key off and on then begin to get a light on panel ,the car started,turned car off then tried again car started,road ca home with no problem ,WHAT COULD BE MY PROBLEM,need to get to work is this an ongoing stop and start problem ,if so WHAT IS ESTIMATE (parts and labor)