JavaScript (ES6), 141 138 bytes
String and direction are input via currying syntax.'/\n|-DI>-/---< ' for left, '/\n|-DI<-\\---> ' for right.
t=>p=>(r=`${s=' '}/${_='-'.repeat(t.length*2+1)}/ |-D$${p}${[...t].join` `} ${p[7]d=p[12]} ${s}\\${_}\\`,p>'I>'d>'<'?r:[...r].reverse().join``:r) f= t=>p=>(r=`${s=' '}/${_='-'.repeat(t.length*2+1)}${p}${[...t].join` `} ${d=p[12]} ${s}\\${_}\\`,d>'<'?[...r].reverse().join``:r) console.log(f('HAPPY BIRTHDAY!')('/\n|-DI>-/---< ')) console.log(f('HAPPY BIRTHDAY!')('/\n|-DI<-\\---> '))