{{-- This page is 'include'-ed in front/products/checkout.blade.php, and will be used by jQuery AJAX to reload it, check front/js/custom.js --}}

Add New Delivery Address

{{-- We created that deliveryText CSS class to use the HTML element as a handle for jQuery to change the

content when clicking the Edit button --}}
@if (count($deliveryAddresses) > 0) {{-- Checking if there are any $deliveryAddreses for the currently authenticated/logged-in user --}} {{-- $deliveryAddresses variable is passed in from checkout() method in Front/ProductsController.php --}} @else {{-- if there're no already existing delivery addresses --}} @endif
{{-- Note: To show the form's Validation Error Messages (Laravel's Validation Error Messages) from the AJAX call response from the server (backend), we create a

tag after every field --}} {{-- We structure and use a certain pattern so that the

id pattern must be like: delivery-x (e.g. delivery-mobile, delivery-email, ... in order for the jQuery loop to work. And x must be identical to the 'name' HTML attributes (e.g. the with the name='mobile' HTML attribute must have a

with an id HTML attribute id="delivery-mobile" ) so that when the vaildation errors array is sent as a response from backend/server (check $validator->messages() inside the method inside the controller) to the AJAX request, they could conveniently/easily be handled by the jQuery $.each() loop. Check front/js/custom.js) --}}

@csrf {{-- We created this hidden field to submit the delivery address id when this HTML Form is submitted via AJAX to save the delivery address in the `delivery_addresses` database table. Check the Save Delivery Addresses via AJAX function in front/js/custom.js file --}}

{{-- This

tag will be used by jQuery to show the Validation Error Messages (Laravel's Validation Error Messages) from the AJAX call response from the server (backend) --}} {{-- We structure and use a certain pattern so that the

id pattern must be like: delivery-x (e.g. delivery-mobile, delivery-email, ... in order for the jQuery loop to work. And x must be identical to the 'name' HTML attributes (e.g. the with the name='mobile' HTML attribute must have a

with an id HTML attribute id="delivery-mobile" ) so that when the vaildation errors array is sent as a response from backend/server (check $validator->messages() inside the method inside the controller) to the AJAX request, they could conveniently/easily be handled by the jQuery $.each() loop. Check front/js/custom.js) --}}

{{-- This

tag will be used by jQuery to show the Validation Error Messages (Laravel's Validation Error Messages) from the AJAX call response from the server (backend) --}} {{-- We structure and use a certain pattern so that the

id pattern must be like: delivery-x (e.g. delivery-mobile, delivery-email, ... in order for the jQuery loop to work. And x must be identical to the 'name' HTML attributes (e.g. the with the name='mobile' HTML attribute must have a

with an id HTML attribute id="delivery-mobile" ) so that when the vaildation errors array is sent as a response from backend/server (check $validator->messages() inside the method inside the controller) to the AJAX request, they could conveniently/easily be handled by the jQuery $.each() loop. Check front/js/custom.js) --}}

{{-- This

tag will be used by jQuery to show the Validation Error Messages (Laravel's Validation Error Messages) from the AJAX call response from the server (backend) --}} {{-- We structure and use a certain pattern so that the

id pattern must be like: delivery-x (e.g. delivery-mobile, delivery-email, ... in order for the jQuery loop to work. And x must be identical to the 'name' HTML attributes (e.g. the with the name='mobile' HTML attribute must have a

with an id HTML attribute id="delivery-mobile" ) so that when the vaildation errors array is sent as a response from backend/server (check $validator->messages() inside the method inside the controller) to the AJAX request, they could conveniently/easily be handled by the jQuery $.each() loop. Check front/js/custom.js) --}}

{{-- This

tag will be used by jQuery to show the Validation Error Messages (Laravel's Validation Error Messages) from the AJAX call response from the server (backend) --}} {{-- We structure and use a certain pattern so that the

id pattern must be like: delivery-x (e.g. delivery-mobile, delivery-email, ... in order for the jQuery loop to work. And x must be identical to the 'name' HTML attributes (e.g. the with the name='mobile' HTML attribute must have a

with an id HTML attribute id="delivery-mobile" ) so that when the vaildation errors array is sent as a response from backend/server (check $validator->messages() inside the method inside the controller) to the AJAX request, they could conveniently/easily be handled by the jQuery $.each() loop. Check front/js/custom.js) --}}

{{-- This

tag will be used by jQuery to show the Validation Error Messages (Laravel's Validation Error Messages) from the AJAX call response from the server (backend) --}} {{-- We structure and use a certain pattern so that the

id pattern must be like: delivery-x (e.g. delivery-mobile, delivery-email, ... in order for the jQuery loop to work. And x must be identical to the 'name' HTML attributes (e.g. the with the name='mobile' HTML attribute must have a

with an id HTML attribute id="delivery-mobile" ) so that when the vaildation errors array is sent as a response from backend/server (check $validator->messages() inside the method inside the controller) to the AJAX request, they could conveniently/easily be handled by the jQuery $.each() loop. Check front/js/custom.js) --}}

{{-- This

tag will be used by jQuery to show the Validation Error Messages (Laravel's Validation Error Messages) from the AJAX call response from the server (backend) --}} {{-- We structure and use a certain pattern so that the

id pattern must be like: delivery-x (e.g. delivery-mobile, delivery-email, ... in order for the jQuery loop to work. And x must be identical to the 'name' HTML attributes (e.g. the with the name='mobile' HTML attribute must have a

with an id HTML attribute id="delivery-mobile" ) so that when the vaildation errors array is sent as a response from backend/server (check $validator->messages() inside the method inside the controller) to the AJAX request, they could conveniently/easily be handled by the jQuery $.each() loop. Check front/js/custom.js) --}}

{{-- This

tag will be used by jQuery to show the Validation Error Messages (Laravel's Validation Error Messages) from the AJAX call response from the server (backend) --}} {{-- We structure and use a certain pattern so that the

id pattern must be like: delivery-x (e.g. delivery-mobile, delivery-email, ... in order for the jQuery loop to work. And x must be identical to the 'name' HTML attributes (e.g. the with the name='mobile' HTML attribute must have a

with an id HTML attribute id="delivery-mobile" ) so that when the vaildation errors array is sent as a response from backend/server (check $validator->messages() inside the method inside the controller) to the AJAX request, they could conveniently/easily be handled by the jQuery $.each() loop. Check front/js/custom.js) --}}

{{-- Save whether it's Add or Edit --}}