Because the ball was dead when the contact occured for the T, this is an intentional technical foul. The penalty is 2 FTs and the ball at midcourt. So you should have allowed A31 to shoot the 1-and-1 for the original personal foul with the lane cleared; then shot 2 FTs for the T; then awarded the ball to team B at midcourt.
Like you said, you got it half-right.
Next time, you'll nail it.