| @@ -167,8 +167,13 @@ | ||
| 167 | 167 | $('#invoice-id').val(response.data.invoice.id); |
| 168 | 168 | invId = response.data.invoice.id; |
| 169 | 169 | } |
| 170 | 170 | if (invId && String(invId) !== '0') { |
| 171 | + // Put the id in the address bar so a refresh, a bookmark or a | |
| 172 | + // second Save reopens this invoice instead of a blank builder. | |
| 173 | + if (window.history && window.history.replaceState && !/[?&]invoice_id=/.test(window.location.search)) { | |
| 174 | + var eiUrl = new URL(window.location.href); eiUrl.searchParams.set('invoice_id', String(invId)); window.history.replaceState({}, '', eiUrl.toString()); | |
| 175 | + } | |
| 171 | 176 | $saveBtn.html('<span class="inline-flex items-center gap-2"><svg class="h-4 w-4 text-gray-600" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4" /></svg><span>' + eiBuilderI18n('update_invoice', 'Update Invoice') + '</span></span>'); |
| 172 | 177 | } |
| 173 | 178 | |
| 174 | 179 | // Update form with any returned data if needed |