Index: frontend/src/pages/billing/BillingDetail.js
===================================================================
--- frontend/src/pages/billing/BillingDetail.js	(revision a64c772a36870a2e14746a963e20b1e6ec1e1538)
+++ frontend/src/pages/billing/BillingDetail.js	(revision cdcff72e9765342b84a5e4b5d98ca5cb050a5500)
@@ -22,11 +22,8 @@
 
   useEffect(() => {
-    fetchBilling();
-  }, [id]);
-
-  const fetchBilling = async () => {
-    try {
-      setLoading(true);
-      const response = await billingService.getBillingById(id);
+    const fetchBilling = async () => {
+      try {
+        setLoading(true);
+        const response = await billingService.getBillingById(id);
       setBilling(response.data);
       setPaymentStatus(response.data.paymentStatus);
@@ -39,11 +36,14 @@
         console.error('Could not fetch billing details:', err);
       }
-    } catch (err) {
-      setError('Failed to fetch billing record');
-      console.error(err);
-    } finally {
-      setLoading(false);
-    }
-  };
+      } catch (err) {
+        setError('Failed to fetch billing record');
+        console.error(err);
+      } finally {
+        setLoading(false);
+      }
+    };
+
+    fetchBilling();
+  }, [id]);
 
   const handleUpdatePaymentStatus = async () => {
@@ -81,8 +81,8 @@
   if (user.role === 'DOCTOR' || user.role === 'LAB_TECHNICIAN') {
     return (
-        <div style={{ padding: '20px', textAlign: 'center' }}>
-          <h1 className="text-2xl font-bold" style={{ color: '#7c3aed', marginBottom: '10px' }}>Access Denied</h1>
-          <p style={{ color: 'var(--color-neutral-600)' }}>You do not have permission to access billing records.</p>
-        </div>
+      <div style={{ padding: '20px', textAlign: 'center' }}>
+        <h1 className="text-2xl font-bold" style={{ color: '#7c3aed', marginBottom: '10px' }}>Access Denied</h1>
+        <p style={{ color: 'var(--color-neutral-600)' }}>You do not have permission to access billing records.</p>
+      </div>
     );
   }
@@ -90,144 +90,144 @@
   if (!billing) {
     return (
-        <div>
-          <ErrorAlert message="Billing record not found" onClose={() => navigate('/billing')} />
-        </div>
+      <div>
+        <ErrorAlert message="Billing record not found" onClose={() => navigate('/billing')} />
+      </div>
     );
   }
 
   return (
-      <div>
-        <div className="flex justify-between items-center mb-6">
-          <h1 className="text-3xl font-bold" style={{ color: '#7c3aed' }}>Billing Record #{billing.billId}</h1>
-          <div className="space-x-2">
-            <button
-                onClick={handleDownloadInvoice}
-                disabled={downloading}
-                className="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 disabled:opacity-50"
-            >
-              {downloading ? 'Downloading...' : 'Download Invoice (PDF)'}
-            </button>
-            <button onClick={() => navigate('/billing')} className="bg-gray-300 text-gray-700 px-4 py-2 rounded hover:bg-gray-400">
-              Back
-            </button>
-          </div>
+    <div>
+      <div className="flex justify-between items-center mb-6">
+        <h1 className="text-3xl font-bold" style={{ color: '#7c3aed' }}>Billing Record #{billing.billId}</h1>
+        <div className="space-x-2">
+          <button
+            onClick={handleDownloadInvoice}
+            disabled={downloading}
+            className="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 disabled:opacity-50"
+          >
+            {downloading ? 'Downloading...' : 'Download Invoice (PDF)'}
+          </button>
+          <button onClick={() => navigate('/billing')} className="bg-gray-300 text-gray-700 px-4 py-2 rounded hover:bg-gray-400">
+            Back
+          </button>
         </div>
-
-        {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
-        {success && <SuccessAlert message={success} onClose={() => setSuccess(null)} />}
-
-        <div className={`grid gap-6 mb-6 ${isPatient ? 'grid-cols-1 lg:grid-cols-2' : 'grid-cols-1 lg:grid-cols-3'}`}>
+      </div>
+
+      {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
+      {success && <SuccessAlert message={success} onClose={() => setSuccess(null)} />}
+
+      <div className={`grid gap-6 mb-6 ${isPatient ? 'grid-cols-1 lg:grid-cols-2' : 'grid-cols-1 lg:grid-cols-3'}`}>
+        <div className="bg-white rounded-lg shadow p-6">
+          <h2 className="text-xl font-bold mb-4">Billing Information</h2>
+          <div className="space-y-3">
+            <InfoRow label="Patient" value={billing.patientName} />
+            <InfoRow label="Total Cost" value={`$${billing.totalCost}`} />
+            <InfoRow label="Current Status" value={billing.paymentStatus} />
+            <InfoRow label="Payment Date" value={billing.paymentDate || 'Not paid'} />
+          </div>
+        </div>
+
+        {!isPatient && (
           <div className="bg-white rounded-lg shadow p-6">
-            <h2 className="text-xl font-bold mb-4">Billing Information</h2>
-            <div className="space-y-3">
-              <InfoRow label="Patient" value={billing.patientName} />
-              <InfoRow label="Total Cost" value={`$${billing.totalCost}`} />
-              <InfoRow label="Current Status" value={billing.paymentStatus} />
-              <InfoRow label="Payment Date" value={billing.paymentDate || 'Not paid'} />
+            <h2 className="text-xl font-bold mb-4">Update Payment Status</h2>
+            <div className="space-y-4">
+              <div>
+                <label className="block text-sm font-semibold mb-2">Payment Status</label>
+                <select
+                  value={paymentStatus}
+                  onChange={(e) => setPaymentStatus(e.target.value)}
+                  className="w-full px-4 py-2 border rounded-lg"
+                >
+                  <option value="PENDING">Pending</option>
+                  <option value="PAID">Paid</option>
+                  <option value="CANCELLED">Cancelled</option>
+                </select>
+              </div>
+              <button
+                onClick={handleUpdatePaymentStatus}
+                disabled={updating || paymentStatus === billing.paymentStatus}
+                className="w-full bg-purple-600 text-white px-4 py-2 rounded hover:bg-purple-700 disabled:opacity-50"
+              >
+                {updating ? 'Updating...' : 'Update Status'}
+              </button>
             </div>
           </div>
-
-          {!isPatient && (
-              <div className="bg-white rounded-lg shadow p-6">
-                <h2 className="text-xl font-bold mb-4">Update Payment Status</h2>
-                <div className="space-y-4">
-                  <div>
-                    <label className="block text-sm font-semibold mb-2">Payment Status</label>
-                    <select
-                        value={paymentStatus}
-                        onChange={(e) => setPaymentStatus(e.target.value)}
-                        className="w-full px-4 py-2 border rounded-lg"
-                    >
-                      <option value="PENDING">Pending</option>
-                      <option value="PAID">Paid</option>
-                      <option value="CANCELLED">Cancelled</option>
-                    </select>
-                  </div>
-                  <button
-                      onClick={handleUpdatePaymentStatus}
-                      disabled={updating || paymentStatus === billing.paymentStatus}
-                      className="w-full bg-purple-600 text-white px-4 py-2 rounded hover:bg-purple-700 disabled:opacity-50"
-                  >
-                    {updating ? 'Updating...' : 'Update Status'}
-                  </button>
-                </div>
-              </div>
-          )}
-
-          <div className="bg-white rounded-lg shadow p-6">
-            <h2 className="text-xl font-bold mb-4">Patient Details</h2>
-            <div className="space-y-3">
-              {billingDetail && (
-                  <>
-                    <InfoRow label="EMBG" value={billingDetail.patientEmbg} />
-                    <InfoRow label="Phone" value={billingDetail.patientPhone} />
-                    <InfoRow label="Bill Date" value={billingDetail.billDate} />
-                  </>
-              )}
+        )}
+
+        <div className="bg-white rounded-lg shadow p-6">
+          <h2 className="text-xl font-bold mb-4">Patient Details</h2>
+          <div className="space-y-3">
+            {billingDetail && (
+              <>
+                <InfoRow label="EMBG" value={billingDetail.patientEmbg} />
+                <InfoRow label="Phone" value={billingDetail.patientPhone} />
+                <InfoRow label="Bill Date" value={billingDetail.billDate} />
+              </>
+            )}
+          </div>
+        </div>
+      </div>
+
+      <div className="bg-white rounded-lg shadow p-6">
+        <h2 className="text-xl font-bold mb-4">Itemized Services</h2>
+
+        {billingDetail && (billingDetail.procedures.length > 0 || billingDetail.labTests.length > 0) ? (
+          <div className="space-y-4">
+            {billingDetail.procedures.length > 0 && (
+              <div>
+                <h3 className="font-semibold text-lg mb-2">Procedures</h3>
+                <table className="w-full">
+                  <thead className="bg-gray-100">
+                    <tr>
+                      <th className="px-4 py-2 text-left">Description</th>
+                      <th className="px-4 py-2 text-right">Cost</th>
+                    </tr>
+                  </thead>
+                  <tbody>
+                    {billingDetail.procedures.map((proc, idx) => (
+                      <tr key={idx} className="border-t">
+                        <td className="px-4 py-2">{proc.description}</td>
+                        <td className="px-4 py-2 text-right">${proc.cost}</td>
+                      </tr>
+                    ))}
+                  </tbody>
+                </table>
+              </div>
+            )}
+
+            {billingDetail.labTests.length > 0 && (
+              <div>
+                <h3 className="font-semibold text-lg mb-2">Lab Tests</h3>
+                <table className="w-full">
+                  <thead className="bg-gray-100">
+                    <tr>
+                      <th className="px-4 py-2 text-left">Description</th>
+                      <th className="px-4 py-2 text-right">Cost</th>
+                    </tr>
+                  </thead>
+                  <tbody>
+                    {billingDetail.labTests.map((test, idx) => (
+                      <tr key={idx} className="border-t">
+                        <td className="px-4 py-2">{test.description}</td>
+                        <td className="px-4 py-2 text-right">${test.cost}</td>
+                      </tr>
+                    ))}
+                  </tbody>
+                </table>
+              </div>
+            )}
+
+            <div className="border-t-2 pt-4 mt-4 flex justify-end">
+              <div className="text-right">
+                <p className="text-gray-600">Total Amount:</p>
+                <p className="text-2xl font-bold text-purple-600">${billing.totalCost}</p>
+              </div>
             </div>
           </div>
-        </div>
-
-        <div className="bg-white rounded-lg shadow p-6">
-          <h2 className="text-xl font-bold mb-4">Itemized Services</h2>
-
-          {billingDetail && (billingDetail.procedures.length > 0 || billingDetail.labTests.length > 0) ? (
-              <div className="space-y-4">
-                {billingDetail.procedures.length > 0 && (
-                    <div>
-                      <h3 className="font-semibold text-lg mb-2">Procedures</h3>
-                      <table className="w-full">
-                        <thead className="bg-gray-100">
-                        <tr>
-                          <th className="px-4 py-2 text-left">Description</th>
-                          <th className="px-4 py-2 text-right">Cost</th>
-                        </tr>
-                        </thead>
-                        <tbody>
-                        {billingDetail.procedures.map((proc, idx) => (
-                            <tr key={idx} className="border-t">
-                              <td className="px-4 py-2">{proc.description}</td>
-                              <td className="px-4 py-2 text-right">${proc.cost}</td>
-                            </tr>
-                        ))}
-                        </tbody>
-                      </table>
-                    </div>
-                )}
-
-                {billingDetail.labTests.length > 0 && (
-                    <div>
-                      <h3 className="font-semibold text-lg mb-2">Lab Tests</h3>
-                      <table className="w-full">
-                        <thead className="bg-gray-100">
-                        <tr>
-                          <th className="px-4 py-2 text-left">Description</th>
-                          <th className="px-4 py-2 text-right">Cost</th>
-                        </tr>
-                        </thead>
-                        <tbody>
-                        {billingDetail.labTests.map((test, idx) => (
-                            <tr key={idx} className="border-t">
-                              <td className="px-4 py-2">{test.description}</td>
-                              <td className="px-4 py-2 text-right">${test.cost}</td>
-                            </tr>
-                        ))}
-                        </tbody>
-                      </table>
-                    </div>
-                )}
-
-                <div className="border-t-2 pt-4 mt-4 flex justify-end">
-                  <div className="text-right">
-                    <p className="text-gray-600">Total Amount:</p>
-                    <p className="text-2xl font-bold text-purple-600">${billing.totalCost}</p>
-                  </div>
-                </div>
-              </div>
-          ) : (
-              <p className="text-gray-500">No services itemized for this billing record.</p>
-          )}
-        </div>
-      </div>
+        ) : (
+          <p className="text-gray-500">No services itemized for this billing record.</p>
+        )}
+      </div>
+    </div>
   );
 }
@@ -235,8 +235,8 @@
 function InfoRow({ label, value }) {
   return (
-      <div className="flex justify-between">
-        <span className="text-gray-800">{label}:</span>
-        <span className="text-gray-800">{value || 'N/A'}</span>
-      </div>
+    <div className="flex justify-between">
+      <span className="text-gray-800">{label}:</span>
+      <span className="text-gray-800">{value || 'N/A'}</span>
+    </div>
   );
 }
