Condition for fractional ideals to be isomorphic in a Dedekind domain

The question is :

Let $R$ be a Dedekind domain and $I,J$ be fractional ideals in $R$. Then $I \cong J$ as $R-$modules if and only if $IJ^{-1}$ is a principal ideal of the quotient field $K(R)$ of $R$ i.e. $[I]=[J]$ in the class group $C(R)$.

The hint given was in one direction : if $\phi : I \to J$ is an isomorphism, then I must show that $\frac{\phi(a)}a$ is constant (doesn't depend on $a$).

In the reverse direction , if $IJ^{-1} = (c)$ for some $c \in K(R)$, then since $I$ is fractional and $R$ is Dedekind, $I = \frac{(a,b)}r$ for some $r$, since every ideal is doubly generated in a Dedekind domain, and similarly for $J$. How does this give me an isomorphism?

In the forward direction, if we assume first that $I,J$ are integral (i.e. ideals of $R$ itself) then pick $a \in I$ and note that ,$\phi : I \to J$ induces $\phi_m : S_m^{-1}I \to S_m^{-1} J$ (the localizations of $I$ and $J$ at every maximal ideal $m$, particularly those $m_i$ which contain $a$). Now, $S_{m_i}^{-1}(a)$ is mapped to some $S_{m_i}^{-1}(b)$ since $S_m^{-1}R$ is a discrete valuation ring. But I am not able to bring in $\frac{\phi(a)}a$ anywhere : how do I bring the quotient in, in the first place?

Assume that $[I]=[J]$. Then we know that $\exists a,b \in R$ s.t. $(a)I = (b)J$. In particular for $x \in I$ there exists unique $y \in J$ s.t. $ax = by$. Now define a map $\phi: I \to J$ by sending $x$ to $y$. As mentioned above this map is a bijection and we only need to prove that $\phi$ is a module homomorphism. Now we have that if $ax_1 = by_1$ and $ax_2 = by_2$ then $a(x_1+x_2) = b(y_1+y_2)$. This means that:

$$\phi(x_1 + x_2) = y_1 + y_2 = \phi(x_1) + \phi(x_2)$$

Also if $r \in R$, then if $ax = by$ we have that $a(rx) = b(ry)$. Thus we have that:

$$\phi(rx) = ry = r\phi(y)$$

This finishes the first direction.

For the other side I have a proof that doesn't make use of the hint. Let $\phi: I \to J$ be an $R$-module isomorphism. Then $\exists r,k \not = 0 \in R$ s.t. $rI \subseteq R$ and $kJ \subset R$, as $I$ and $J$ are fractional ideals. Now it's not hard to see that the restriction of $\phi$ to $rkI$ is an isomorphism between $(rk)I$ and $(rk)J$, which are both integral ideals.

Indeed $\phi(rkx) = rk\phi(x) = rky$ and the bijectivity isn't hard to proof. Now we'll prove that for a fixed $x \in (rK)I$ we have $\phi(x)(rk)I = x(rk)J$. This follows as:

$$\phi(x)(rk)a = \phi(xrka) = x\phi(ra) = xrk\phi(a) \in xrkJ \implies \phi(x)rkI \subset xrkJ$$ $$xrkb = xrk\phi(a) = \phi(xrka) = \phi(x)rka \in \phi(x)rkI \implies xrkJ \subset \phi(x)rkI$$

Note that in the first line we used the fact that $rka \in R$ to put it inside the isomorphism. While in the second line we used the surjectivity of $\phi$ to get that for every $b \in j$ there is $a \in I$ s.t. $\phi(a) = b$.

So as $x \in (rk)I \subset R$ and $\phi(x) \in (rk)J \subset R$ we get that $(rk)I \sim (rk)J$. Thus we have that $[(rk)I]=[(rk)J] \implies [(rk)][I] = [(rk)][J] \implies [I]=[J]$. Hence the proof.