|
309 | 309 | @section('footer-scripts') |
310 | 310 | @parent |
311 | 311 | {!! Theme::js('vendor/lodash/lodash.js') !!} |
| 312 | + |
| 313 | + <script type="application/javascript"> |
| 314 | + // Persist 'Service Variables' |
| 315 | + function serviceVariablesUpdated(eggId, ids) { |
| 316 | + @if (old('egg_id')) |
| 317 | + // Check if the egg id matches. |
| 318 | + if (eggId != '{{ old('egg_id') }}') { |
| 319 | + return; |
| 320 | + } |
| 321 | +
|
| 322 | + @if (old('environment')) |
| 323 | + @foreach (old('environment') as $key => $value) |
| 324 | + $('#' + ids['{{ $key }}']).val('{{ $value }}'); |
| 325 | + @endforeach |
| 326 | + @endif |
| 327 | + @endif |
| 328 | + } |
| 329 | + // END Persist 'Service Variables' |
| 330 | + </script> |
| 331 | + |
312 | 332 | {!! Theme::js('js/admin/new-server.js') !!} |
313 | 333 |
|
314 | 334 | <script type="application/javascript"> |
315 | 335 | $(document).ready(function() { |
316 | | - <!-- Persist 'Server Owner' select2 --> |
| 336 | + // Persist 'Server Owner' select2 |
317 | 337 | @if (old('owner_id')) |
318 | 338 | $.ajax({ |
319 | 339 | url: '/admin/users/accounts.json?user_id={{ old('owner_id') }}', |
|
324 | 344 | @else |
325 | 345 | initUserIdSelect(); |
326 | 346 | @endif |
327 | | - <!-- END Persist 'Server Owner' select2 --> |
| 347 | + // END Persist 'Server Owner' select2 |
328 | 348 |
|
329 | | - <!-- Persist 'Node' select2 --> |
| 349 | + // Persist 'Node' select2 |
330 | 350 | @if (old('node_id')) |
331 | 351 | $('#pNodeId').val('{{ old('node_id') }}').change(); |
332 | 352 |
|
333 | | - <!-- Persist 'Default Allocation' select2 --> |
| 353 | + // Persist 'Default Allocation' select2 |
334 | 354 | @if (old('allocation_id')) |
335 | 355 | $('#pAllocation').val('{{ old('allocation_id') }}').change(); |
336 | 356 | @endif |
337 | | - <!-- END Persist 'Default Allocation' select2 --> |
| 357 | + // END Persist 'Default Allocation' select2 |
338 | 358 |
|
339 | | - <!-- Persist 'Additional Allocations' select2 --> |
| 359 | + // Persist 'Additional Allocations' select2 |
340 | 360 | @if (old('allocation_additional')) |
341 | 361 | const additional_allocations = []; |
342 | 362 |
|
|
346 | 366 |
|
347 | 367 | $('#pAllocationAdditional').val(additional_allocations).change(); |
348 | 368 | @endif |
349 | | - <!-- END Persist 'Additional Allocations' select2 --> |
| 369 | + // END Persist 'Additional Allocations' select2 |
350 | 370 | @endif |
351 | | - <!-- END Persist 'Node' select2 --> |
| 371 | + // END Persist 'Node' select2 |
352 | 372 |
|
353 | | - <!-- Persist 'Nest' select2 --> |
| 373 | + // Persist 'Nest' select2 |
354 | 374 | @if (old('nest_id')) |
355 | 375 | $('#pNestId').val('{{ old('nest_id') }}').change(); |
356 | 376 |
|
357 | | - <!-- Persist 'Egg' select2 --> |
| 377 | + // Persist 'Egg' select2 |
358 | 378 | @if (old('egg_id')) |
359 | 379 | $('#pEggId').val('{{ old('egg_id') }}').change(); |
360 | 380 | @endif |
361 | | - <!-- END Persist 'Egg' select2 --> |
| 381 | + // END Persist 'Egg' select2 |
362 | 382 |
|
363 | | - <!-- Persist 'Data Pack' select2 --> |
| 383 | + // Persist 'Data Pack' select2 |
364 | 384 | @if (old('pack_id')) |
365 | 385 | $('#pPackId').val('{{ old('pack_id') }}').change(); |
366 | 386 | @endif |
367 | | - <!-- END Persist 'Data Pack' select2 --> |
| 387 | + // END Persist 'Data Pack' select2 |
368 | 388 | @endif |
369 | | - <!-- END Persist 'Nest' select2 --> |
| 389 | + // END Persist 'Nest' select2 |
370 | 390 | }); |
371 | 391 | </script> |
372 | 392 | @endsection |
0 commit comments