![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mcoil.corals.io/resources/views/front/ |
@inject('service', 'App\library\InjectService') @extends('layouts.front.app') @section('stylesheets') <link href="{{ asset('css/sweetalert2.min.css') }}" rel="stylesheet" type="text/css" /> @endsection @section('content') @include('layouts.front.other-menu') <section class="container content"> <div class="row"> <div class="box-body"> @include('layouts.errors-and-messages') </div> </div> <div class="row"> <div class="col-md-12"> <div> <ul class="nav nav-tabs" role="tablist"> <li role="presentation" @if(request()->input('tab') == 'profile') class="active" @endif><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li> <li role="presentation" @if(request()->input('tab') == 'orders') class="active" @endif><a href="#orders" aria-controls="orders" role="tab" data-toggle="tab">Orders</a></li> <li role="presentation" @if(request()->input('tab') == 'address') class="active" @endif><a href="#address" aria-controls="address" role="tab" data-toggle="tab">Addresses</a></li> </ul> <div class="tab-content customer-order-list"> <div role="tabpanel" class="tab-pane @if(request()->input('tab') == 'profile')active @endif" id="profile"> <p>If you wish to update your accounts login details, please do so in the form below.</p> <form id="profileupdate" name="profileupdate" action="{{ route('customer.profile.update') }}" method="post"> {{ csrf_field() }} <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="fname">First Name <span class="text-danger">*</span></label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-user"></i></span> <input type="text" id="fname" name="fname" value="{{$customer->fname}}" class="form-control input-lg" /> </div> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="lname">Surname <span class="text-danger">*</span></label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-user"></i></span> <input type="text" id="lname" name="lname" value="{{$customer->lname}}" class="form-control input-lg" /> </div> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="buisness-account">Business Account</label> <select name="business_account" id="business_account" class="form-control input-lg"> <option value="1" @if($customer->business_account == '1') selected="selected" @endif>Yes</option> <option value="0" @if($customer->business_account == '0') selected="selected" @endif>No</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="buisness-name">Business Name</label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-suitcase"></i></span> <input type="text" name="business_account_name" id="business_account_name" placeholder="Business Name" class="form-control input-lg" value="{!! $customer->business_account_name ?: old('business_account_name') !!}"> </div> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="email">Email Address <span class="text-danger">*</span></label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-at"></i></span> <input type="text" id="email" name="email" class="form-control input-lg" value="{{$customer->email}}" /> </div> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="pass">Password</label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-lock"></i></span> <input type="password" id="pass" name="pass" placeholder="********" value="" class="form-control input-lg" /> </div> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="pass2">Confirm Password</label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-lock"></i></span> <input type="password" id="pass2" name="pass2" placeholder="********" class="form-control input-lg" value="" /> </div> </div> </div> <div class="col-md-6"> <div class="form-group"> <label></label> <input type="submit" name="submit" value="Update" id="submit-btn" class="btn btn-lg btn-block btn-send" /> </div> </div> </div> </form> </div> <div role="tabpanel" class="tab-pane @if(request()->input('tab') == 'orders')active @endif table-responsive-md" id="orders"> @if(count($products) > 0) <div> <h3 class="bold">Product Orders </h3> <p>All your product orders with us will be placed in the table below. Please click on their link to view their invoice.</p> @if(!$orders->isEmpty()) <table class="table table-striped table-hover table-checkable dataTable table-responsive table-responsive-md responsive" id="order_table"> <thead class="thead-dark"> <tr> <th scope="col" class="all">ID:</th> <th scope="col" class="min-mobile-l">Product:</th> <th scope="col" class="min-tablet-l">Total:</th> <th scope="col" class="desktop">Date:</th> <th scope="col" class="min-tablet-l">Status:</th> <th></th> </tr> </thead> <tbody> @foreach ($orders as $order) <tr> <td class="dtr-control">{{ $order['id'] }}</td> <td> @php $orderCount = count($order['products']); @endphp @php $orderCounter = 1; @endphp @foreach ($order['products'] as $product) <a data-toggle="modal" data-target="#order_modal_{{$order['id']}}" title="{{$product['name']}}" href="#"> {{$product['name']}} </a> ({{$product['pivot']['quantity']}}){{ ( $orderCounter < $orderCount ) ? ', ': '' }} @php $orderCounter++; @endphp @endforeach </td> <td>{{ config('cart.currency_symbol') }}{{ $order['total_paid'] }}</td> <td data-sort="{{ date('Ymd', strtotime($order['created_at'])) }}">{{ date('M d, Y h:i a', strtotime($order['created_at'])) }}</td> <td><span class='badge font-badge @if ($order["status"]->name == "paid") badge-success @elseif($order["status"]->name == "pending") badge-warning @elseif($order["status"]->name == "awaiting payment") badge-awaiting @elseif($order["status"]->name == "error") badge-danger @else @endif'>{{ $order['status']->name }}</span></td> <td> <div class="btn-group"> <a data-toggle="modal" data-target="#order_modal_{{$order['id']}}" title="Show order" href="#" class="btn btn-dark">View Invoice</a> @if(($order['status']->name == "awaiting payment" && $order['created_by_admin'] == 1) || ($order['status']->name == "pending")) <a class="btn btn-success" href="{{ route('checkout.index', [$order['id']]) }}">Pay</a> @endif </div> </td> </tr> @endforeach </tbody> </table> @else <p class="alert alert-warning">No orders yet. <a href="{{ route('home') }}">Shop now!</a></p> @endif </div> @endif <div> <h3 class="bold">Oil Orders</h3> <p>All your oil orders with us will be placed in the table below. Please click on their link to view their invoice.</p> @if(!$oilOrders->isEmpty()) <table class="table table-striped table-hover table-checkable dataTable table-responsive table-responsive-md responsive" id="order_oil_table"> <thead class="thead-dark"> <tr> <th scope="col" class="all">ID:</th> <th scope="col" class="min-mobile-l">Product:</th> <th scope="col" class="min-tablet-l">Total:</th> <th scope="col" class="desktop">Date:</th> <th scope="col" class="min-tablet-l">Status:</th> <th></th> </tr> </thead> <tbody> @foreach ($oilOrders as $order) <tr> <td class="dtr-control">{{ $order['id'] }}</td> <td> @foreach ($order['products'] as $product) <a data-toggle="modal" data-target="#order_modal_{{$order['id']}}" title="{{$product['name']}}" href="#"> @if(isset($product->cover)) <img src="{{ URL::asset('/public/storage/'.$product->cover) }}" alt="" style="height: 15px;width: 15px; margin-right:5px" /> @else <img src="{{ url('/images/default.jpg') }}" style="height: 15px;width: 15px; margin-right:5px" alt="" /> @endif {{$product['name']}}</a> (@if($product['pivot']['quantity'] == 0){{'Fill the Tank'}}@else{{$product['pivot']['quantity']}}@endif) @endforeach </td> <td>{{ config('cart.currency_symbol') }}{{ $order['total_paid'] }}</td> <td data-sort="{{ date('Ymd', strtotime($order['created_at'])) }}">{{ date('M d, Y h:i a', strtotime($order['created_at'])) }}</td> <td><span class='badge font-badge @if ($order["status"]->name == "paid") badge-success @elseif($order["status"]->name == "pending") badge-warning @elseif($order["status"]->name == "awaiting payment") badge-awaiting @elseif($order["status"]->name == "error") badge-danger @else @endif'>{{ $order['status']->name }}</span></td> <td> @if($order['status']->name == "awaiting payment" && $order['created_by_admin'] == 1 && $order['payment_option'] == "Credit Card") <form action="{{ route('quote.checkout') }}" method="post"> {{ csrf_field() }} <input type="hidden" name="order_id" value="{{ $order['id'] }}"> <div class="btn-group"> <a data-toggle="modal" data-target="#order_modal_{{$order['id']}}" title="Show order" href="#" class="btn btn-dark">View Invoice</a> <button class="btn btn-success">Pay</button> </div> </form> @else <div class="btn-group"> <a data-toggle="modal" data-target="#order_modal_{{$order['id']}}" title="Show order" href="#" class="btn btn-dark">View Invoice</a> </div> @endif </td> </tr> @endforeach </tbody> </table> @else <p class="alert alert-warning">No orders yet. <a href="{{ route('home') }}">Shop now!</a></p> @endif </div> </div> <div role="tabpanel" class="tab-pane @if(request()->input('tab') == 'address')active @endif table-responsive-md" id="address"> <p>Your billing and delivery addresses stored in our system will be placed in the table below. You may create, update or delete them.</p> <div class="row"> <div class="col-md-3"> <a href="#" class="btn btn-outline-dark btn-lg btn-block font-black" id="btn_add_new_address">Create New Address</a> </div> </div><br /> @if(!$addresses->isEmpty()) <h3 class="bold">Billing Address</h3> <table class="table table-striped table-hover table-checkable dataTable table-responsive table-responsive-md responsive" id="billing_table"> <thead class="thead-dark"> <tr> <th scope="col" class="all">Address:</th> <th scope="col" class="min-tablet-l">Eircode:</th> <th scope="col" class="min-tablet-l">Phone:</th> <th scope="col" class="all"></th> </tr> </thead> <tbody> @foreach($addresses as $address) @if( $address->billing_type_address == 1 ) <tr> <td class="dtr-control">{{ $address->address_1 }}<?php if (isset($address->address_2)) { if (isset($address->address_1)) { echo ', '; } echo $address->address_2; } ?>, {{$address->town}}, {{$address->county}}</td> <td>{{$address->zip}}</td> <td>{{$address->phone}}</td> <td> <div class="btn-group"> <a href="#" class="btn btn-dark font-black btn_edit_address" id="{{ $address->id }}">Edit</a> </div> </td> </tr> @endif @endforeach </tbody> </table> @else <br /><p class="alert alert-warning">No address created yet.</p> @endif @if(!$addresses->isEmpty()) <h3 class="bold margin-top-30">Delivery Address</h3> <table class="table table-striped table-hover table-checkable dataTable table-responsive table-responsive-md responsive" id="delivery_table"> <thead class="thead-dark"> <tr> <th scope="col" class="all">Address:</th> <th scope="col" class="min-tablet-l">Eircode:</th> <th scope="col" class="min-tablet-l">Phone:</th> <th scope="col" class="all"></th> </tr> </thead> <tbody> @foreach($addresses as $address) @if( $address->billing_type_address == 0 ) <tr> <td class="dtr-control">{{ $address->address_1 }}<?php if (isset($address->address_2)) { if (isset($address->address_1)) { echo ', '; } echo $address->address_2; } ?>, {{$address->town}}, {{$address->county}}</td> <td>{{$address->zip}}</td> <td>{{$address->phone}}</td> <td> <form method="post" action="{{ route('customer.address.destroy', [auth()->user()->id, $address->id]) }}" class="form-horizontal"> <input type="hidden" name="_method" value="delete"> {{ csrf_field() }} <div class="btn-group"> <a href="#" class="btn btn-dark font-black btn_edit_address" id="{{ $address->id }}">Edit</a> <button type="submit" data-product="{{ $address->id }}" class="btn btn-send font-14 delete_address">Delete</button> </div> </form> </td> </tr> @endif @endforeach </tbody> </table> @else <br /><p class="alert alert-warning">No address created yet.</p> @endif </div> </div> </div> </div> </div> </section> @foreach ($orders as $order) <div class="modal fade" id="order_modal_{{$order['id']}}" tabindex="-1" role="dialog" aria-labelledby="MyOrders"> <div class="modal-dialog invoice-modal" role="document"> <div class="modal-content"> <div class="modal-header toolbar hidden-print"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <div class="col-md-2 text-left"> <button class="btn btn-dark btn-lg btn-block font-black printinvoice-temp"><i class="fa fa-print"></i> Print</button> </div> </div> <div class="modal-body table-responsive-md"> <div> <div class="invoice-temp overflow-auto"> <div class="invoice-div"> <header> <div class="row row-flex"> <div class="col invoice-temp-logo"> @if(!empty($website_setting->header_logo)) <img src="{{ asset('/public/img/images_uploaded/'.$website_setting->header_logo)}}" alt="{{ config('app.name') }}" data-holder-rendered="true" /> @endif </div> <div class="col company-details"> <h2 class="name">{{ $contact_info['contact_name'] }}</h2> <div>{{ $contact_info['address'] }}</div> <div>{{ $contact_info['phone'] }}</div> <div>{{ $contact_info['email'] }}</div> </div> </div> </header> <main> <div class="row row-flex contacts"> <div class="col invoice-temp-details"> @if($order['order_status'] == '0') <h1 class="@if($order['status']->name == 'paid') invoice-temp-paid @elseif($order['status']->name == 'pending') invoice-temp-pending @elseif($order['status']->name == 'awaiting payment') invoice-temp-awaiting @elseif($order['status']->name == 'cancelled') invoice-temp-cancelled @else invoice-temp-unpaid @endif">{{ strtoupper($order['status']->name) }}</h1> @elseif($order['order_status'] == '1' && $order['status']->name == 'paid') <h1 class="@if($order['status']->name == 'paid') invoice-temp-paid @elseif($order['status']->name == 'pending') invoice-temp-pending @elseif($order['status']->name == 'awaiting payment') invoice-temp-awaiting @elseif($order['status']->name == 'cancelled') invoice-temp-cancelled @else invoice-temp-unpaid @endif">{{ strtoupper($order['status']->name) }}</h1> @else <h1 class="invoice-temp-cancelled"> DELIVERED </h1> @endif </div> </div> <div class="row row-flex contacts"> <div class="col invoice-temp-to"> <div class="text-gray-light">INVOICE TO:</div> <h2 class="to">{{ $customer['name'] }}</h2> <div class="address">{{$order['address']->address_1}}, <?php if (!empty($order['address']->address_2)) { echo $order['address']->address_2.','; } ?> {{$order['address']->town}}, {{$order['address']->county}}, {{$order['address']->zip}}</div> <div class="email">{{ $customer['email'] }}</div> </div> <div class="col invoice-temp-details"> <h1 class="invoice-temp-id">INVOICE #{{$order['id']}}</h1> <div class="date">Date of Invoice: {{ date('d/m/Y', strtotime($order['updated_at'])) }}</div> </div> </div> <div class="notices"> <h1 class="invoice-delivery">DELIVERY ADDRESS:</h1> <div class="notice"> @if( $addresses ) @foreach( $addresses as $address ) @if( $order['delivery_address_id'] == $address->id ) {{ $address->address_1 }}{{ ( $address->address_2 != '' ) ? ', ' . $address->address_2: '' }}{{ ( $address->town != '' ) ? ', ' . $address->town: '' }}{{ ( $address->county != '' ) ? ', ' . $address->county: '' }}{{ ( $address->zip != '' ) ? ', ' . $address->zip: '' }} @endif @endforeach @endif </div> </div> <table border="0" cellspacing="0" cellpadding="0"> <thead> <tr> <th>#</th> <th class="text-left">DESCRIPTION</th> <th class="text-right">VAT</th> <th class="text-right">QTY</th> <th class="text-right">TOTAL</th> </tr> </thead> <tbody> @foreach ($order['products'] as $product) <tr> <td class="no">{{ $product['id'] }}</td> <td class="text-left maintitle"><h3>{{ $product['name'] }}</h3></td> <?php $productId = $product['pivot']['product_id']; $productDetails = \DB::table('products')->where('id', $productId)->first(); ?> <td class="unit">{{ floatval($productDetails->tax) }}%</td> <td class="qty">{{ $product['pivot']['quantity'] }}</td> <td class="total">{{ config('cart.currency_symbol') }}{{ number_format(($product['pivot']['product_price'] * $product['pivot']['quantity']), 2)}}</td> </tr> @endforeach </tbody> <tfoot> <tr> <td colspan="3"></td> <td class="footertotal">SUBTOTAL</td> <td class="footertotal">{{ config('cart.currency_symbol') }}{{ number_format((($order['total_paid'] + $order['discounts']) - $order['tax_value']), 2) }}</td> </tr> <tr> <td colspan="3"></td> <td class="footertotal">VAT</td> <td class="footertotal">{{ config('cart.currency_symbol') }}{{ number_format($order['tax_value'], 2) }}</td> </tr> <tr> <td colspan="3"></td> <td class="footertotal">DISCOUNT</td> <td class="footertotal">{{ config('cart.currency_symbol') }}{{ number_format($order['discounts'], 2) }}</td> </tr> <tr> <td colspan="3"></td> <td class="footertotal">GRAND TOTAL</td> <td class="footertotal">{{ config('cart.currency_symbol') }}{{ number_format($order['total_paid'], 2) }}</td> </tr> </tfoot> </table> <div style="font-size: 15px;"> <?php $footerContent = $service->getInvoiceContent("invoice_footer"); ?> @if($footerContent) {!! $footerContent->message !!} @endif </div> </main> </div> <div></div> </div> </div> </div> </div> </div> </div> @endforeach @foreach ($oilOrders as $order) <div class="modal fade" id="order_modal_{{$order['id']}}" tabindex="-1" role="dialog" aria-labelledby="MyOrders"> <div class="modal-dialog invoice-modal" role="document"> <div class="modal-content"> <div class="modal-header toolbar hidden-print"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <div class="col-md-2 text-left"> <button class="btn btn-dark btn-lg btn-block font-black printinvoice-temp"><i class="fa fa-print"></i> Print</button> </div> </div> <div class="modal-body table-responsive-md"> <div> <div class="invoice-temp overflow-auto"> <div class="invoice-div"> <header> <div class="row row-flex"> <div class="col invoice-temp-logo"> @if(!empty($website_setting->header_logo)) <img src="{{ asset('/public/img/images_uploaded/'.$website_setting->header_logo)}}" alt="{{ config('app.name') }}" data-holder-rendered="true" /> @endif </div> <div class="col company-details"> <h2 class="name">{{ $contact_info['contact_name'] }}</h2> <div>{{ $contact_info['address'] }}</div> <div>{{ $contact_info['phone'] }}</div> <div>{{ $contact_info['email'] }}</div> </div> </div> </header> <main> <div class="row row-flex contacts"> <div class="col invoice-temp-details"> @if($order['order_status'] == '0') <h1 class="@if($order['status']->name == 'paid') invoice-temp-paid @elseif($order['status']->name == 'pending') invoice-temp-pending @elseif($order['status']->name == 'awaiting payment') invoice-temp-awaiting @elseif($order['status']->name == 'cancelled') invoice-temp-cancelled @else invoice-temp-unpaid @endif">{{ strtoupper($order['status']->name) }}</h1> @elseif($order['order_status'] == '1' && $order['status']->name == 'paid') <h1 class="@if($order['status']->name == 'paid') invoice-temp-paid @elseif($order['status']->name == 'pending') invoice-temp-pending @elseif($order['status']->name == 'awaiting payment') invoice-temp-awaiting @elseif($order['status']->name == 'cancelled') invoice-temp-cancelled @else invoice-temp-unpaid @endif">{{ strtoupper($order['status']->name) }}</h1> @else <h1 class="invoice-temp-cancelled"> DELIVERED </h1> @endif </div> </div> <div class="row row-flex contacts"> <div class="col invoice-temp-to"> <div class="text-gray-light">INVOICE TO:</div> <h2 class="to">{{ $customer['name'] }}</h2> <div class="address">{{$order['address']->address_1}}, <?php if (!empty($order['address']->address_2)) { echo $order['address']->address_2.','; } ?> {{$order['address']->town}}, {{$order['address']->county}}, {{$order['address']->zip}}</div> <div class="email">{{ $customer['email'] }}</div> </div> <div class="col invoice-temp-details"> <h1 class="invoice-temp-id">INVOICE #{{$order['id']}}</h1> <div class="date">Date of Invoice: {{ date('d/m/Y', strtotime($order['updated_at'])) }}</div> <div class="date">Date of Delivery: {{ date('d/m/Y', strtotime($order['delivery_date'])) }}</div> </div> </div> <div class="notices"> <h1 class="invoice-delivery">DELIVERY ADDRESS:</h1> <div class="notice"> @if( $addresses ) @foreach( $addresses as $address ) @if( $order['delivery_address_id'] == $address->id ) {{ $address->address_1 }}{{ ( $address->address_2 != '' ) ? ', ' . $address->address_2: '' }}{{ ( $address->town != '' ) ? ', ' . $address->town: '' }}{{ ( $address->county != '' ) ? ', ' . $address->county: '' }}{{ ( $address->zip != '' ) ? ', ' . $address->zip: '' }} @endif @endforeach @endif </div> </div> <table border="0" cellspacing="0" cellpadding="0"> <thead> <tr> <th>#</th> <th class="text-left">DESCRIPTION</th> <th class="text-right">VAT</th> <th class="text-right">QTY</th> <th class="text-right">TOTAL</th> </tr> </thead> <tbody> @foreach ($order['products'] as $product) <tr> <td class="no">{{ $product['id'] }}</td> <td class="text-left maintitle"><h3>{{ $product['name'] }}</h3></td> <td class="unit">{{ floatval($order['tax_percentage']) }}%</td> <td class="qty">@if($product['pivot']['quantity'] == 0){{'Fill the Tank'}}@else{{$product['pivot']['quantity']}}@endif</td> <td class="total">{{ config('cart.currency_symbol') }}{{ number_format((($order['total_paid'] + $order['discounts']) - $order['tax_value']), 2) }}</td> </tr> @endforeach </tbody> <tfoot> <tr> <td colspan="3"></td> <td class="footertotal">SUBTOTAL</td> <td class="footertotal">{{ config('cart.currency_symbol') }}{{ number_format((($order['total_paid'] + $order['discounts']) - $order['tax_value']), 2) }}</td> </tr> <tr> <td colspan="3"></td> <td class="footertotal">VAT @ {{ floatval($order['tax_percentage']) }}%</td> <td class="footertotal">{{ config('cart.currency_symbol') }}{{ number_format($order['tax_value'], 2) }}</td> </tr> <tr> <td colspan="3"></td> <td class="footertotal">DISCOUNT</td> <td class="footertotal">{{ config('cart.currency_symbol') }}{{ number_format($order['discounts'], 2) }}</td> </tr> <tr> <td colspan="3"></td> <td class="footertotal">GRAND TOTAL</td> <td class="footertotal">{{ config('cart.currency_symbol') }}{{ number_format($order['total_paid'], 2) }}</td> </tr> </tfoot> </table> <div style="font-size: 15px;"> <?php $footerContent = $service->getInvoiceContent("invoice_footer"); ?> @if($footerContent) {!! $footerContent->message !!} @endif </div> </main> </div> <div></div> </div> </div> </div> </div> </div> </div> @endforeach <div id="modal_create_address" class="modal fade" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Create Address</h4> </div> <div class="modal-body"> <form class="form" name="frm_create_address" id="frm_create_address" autocomplete="off"> <div class="row"> <div class="col-md-6"> {{ csrf_field() }} <div class="form-group"> <label for="address_1">Address 1 <span class="text-danger">*</span></label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-map-marker"></i></span> <input type="text" name="address_1" id="address_1" placeholder="Address 1" class="form-control input-lg" required=""> </div> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="address_2">Address 2 </label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-map-marker"></i></span> <input type="text" name="address_2" id="address_2" placeholder="Address 2" class="form-control input-lg"> </div> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="town">Town <span class="text-danger">*</span></label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-map-marker"></i></span> <input type="text" name="town" id="town" required="" placeholder="Town" class="form-control input-lg"> </div> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="county">County <span class="text-danger">*</span></label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-map-marker"></i></span> <input type="text" name="county" id="county" required="" placeholder="County" class="form-control input-lg"> </div> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div id="provinces" class="form-group" style="display: none;"></div> <div id="cities" class="form-group" style="display: none;"></div> <div class="form-group"> <label for="zip">Eircode <span class="text-danger">*</span></label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-envelope"></i></span> <input type="text" name="zip" id="zip" required="" placeholder="Eircode" class="form-control input-lg"> </div> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="phone">Phone Number <span class="text-danger">*</span></label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-phone"></i></span> <input type="text" name="phone" id="phone" required="" placeholder="Phone number" class="form-control input-lg"> </div> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="row margin-top-30"> <div class="col-md-12 btn-margin-top"> <button type="submit" class="btn btn-lg btn-block btn-send" id="btn_save_new_address">Create</button> </div> </div> </div> </div> </form> <div class="clearfix"></div> </div> </div> </div> </div> <div id="modal_edit_address" class="modal fade" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Update Address</h4> </div> <div class="modal-body"> <form class="form" name="frm_update_address" id="frm_update_address" autocomplete="off"> <div class="row"> <div class="col-md-6"> {{ csrf_field() }} <div class="form-group"> <label for="address_1">Address 1 <span class="text-danger">*</span></label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-map-marker"></i></span> <input type="text" name="address_1" id="address_1" placeholder="Address 1" class="form-control input-lg" required=""> <input type="hidden" name="address_id" id="address_id" value=""> </div> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="address_2">Address 2 </label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-map-marker"></i></span> <input type="text" name="address_2" id="address_2" placeholder="Address 2" class="form-control input-lg"> </div> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="town">Town <span class="text-danger">*</span></label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-map-marker"></i></span> <input type="text" name="town" id="town" required="" placeholder="Town" class="form-control input-lg"> </div> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="county">County <span class="text-danger">*</span></label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-map-marker"></i></span> <input type="text" name="county" id="county" required="" placeholder="County" class="form-control input-lg"> </div> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div id="provinces" class="form-group" style="display: none;"></div> <div id="cities" class="form-group" style="display: none;"></div> <div class="form-group"> <label for="zip">Eircode <span class="text-danger">*</span></label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-envelope"></i></span> <input type="text" name="zip" id="zip" required="" placeholder="Eircode" class="form-control input-lg"> </div> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="phone">Phone Number <span class="text-danger">*</span></label> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-phone"></i></span> <input type="text" name="phone" id="phone" required="" placeholder="Phone number" class="form-control input-lg"> </div> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="row margin-top-30"> <div class="col-md-12 btn-margin-top"> <button type="submit" class="btn btn-lg btn-block btn-send" id="btn_update_address">Update</button> </div> </div> </div> </div> </form> <div class="clearfix"></div> </div> </div> </div> </div> @include('layouts.front.call-to-action-footer') @endsection @section('js') <script src="{{ asset('https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.1/jquery.validate.min.js') }}"></script> <script src="{{ asset('js/sweetalert2.all.min.js') }}"></script> <script type="text/javascript"> $(document).ready( function () { jQuery.validator.addMethod("buisnessName", function(value, element) { let business_account = $('#business_account').val(); if(business_account == '1'){ if(value === ''){ return false; } else{ return true; } }else{ return true; } }, "* PLease enter a Business Name"); $.fn.DataTable.ext.pager.numbers_length = 5; $('#profileupdate').validate({ errorPlacement: function(error, element) { if (element.parent('.input-group').length) { error.insertAfter(element.parent()); } else { error.insertAfter(element); } }, rules: { fname: { required: true }, lname: { required: true }, email: { required: true, email: true }, pass2: { equalTo: "#pass" }, business_account_name: {buisnessName : true}, }, messages: { fname: { required: 'Please enter first name' }, lname: { required: 'Please enter surname' }, email: { required: 'Please enter an email address', email: 'Please enter a valid email address' }, pass2: { equalTo: 'Passwords do not match' } } }); $('#order_table').DataTable({ "responsive": true, "order": [[ 3, "desc" ]], "bAutoWidth": false, "rowReorder": { selector: 'td:nth-child(2)' }, "columnDefs": [ { "width": "140px", "targets": 5 } ] }); $('#order_oil_table').DataTable({ "responsive": true, "order": [[ 3, "desc" ]], "bAutoWidth": false, "rowReorder": { selector: 'td:nth-child(2)' }, "columnDefs": [ { "width": "140px", "targets": 5 } ] }); $('#billing_table').DataTable({ "responsive": true, "order": [[ 0, "desc" ]], "bAutoWidth": false, "rowReorder": { selector: 'td:nth-child(2)' }, "columnDefs": [ { "width": "40px", "targets": 3 } ] }); $('#delivery_table').DataTable({ "responsive": true, "order": [[ 0, "desc" ]], "bAutoWidth": false, "rowReorder": { selector: 'td:nth-child(2)' }, "columnDefs": [ { "width": "100px", "targets": 3 } ] }); $('.printinvoice-temp').click(function() { var outerHTML_text = $(this).closest('.modal-content').find('.invoice-temp').prop('outerHTML'); Popup($(this).closest('.modal-content').find('.invoice-temp').prop('outerHTML', outerHTML_text)); function Popup(data) { window.print(); return true; } }); $('#btn_add_new_address').click(function() { $('#frm_create_address')[0].reset(); $('#modal_create_address').modal({ backdrop: 'static', keyboard: false }); }); $.validator.addMethod("phonenumber", function(value) {var re = /^[\d\s()+-]+$/; return re.test(value);}, "Please enter a valid phone number"); $('#frm_create_address').validate({ errorPlacement: function(error, element) { if(element.parent('.input-group').length) { error.insertAfter(element.parent()); } else { error.insertAfter(element); } }, rules: { address_1: { required: true }, county: { required: true }, town: { required: true }, zip: { required: true }, phone: { phonenumber: true, minlength: 7, maxlength: 19 } }, messages: { address_1: { required: 'Please enter Address 1' }, county: { required: 'Please enter county' }, town: { required: 'Please enter town' }, zip: { required: 'Please enter post code' }, phone: { phonenumber: 'Please enter a valid phone number' } } }); $('#frm_create_address').submit(function(e) { e.preventDefault(); }); $('#btn_save_new_address').click(function(e) { if ($('#frm_create_address').valid()) { $('#modal_create_address').modal('hide'); e.preventDefault(); Swal.fire({ title: 'Updated!', text: "Your address has been added.", type: 'success', showConfirmButton: false, timer: 1500 }); $.ajax({ url: "{{ url('create-address') }}", method: 'post', data: { address_1: $('#address_1').val(), address_2: $('#address_2').val(), county: $('#county').val(), town: $('#town').val(), zip: $('#zip').val(), phone: $('#phone').val(), }, headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}', }, success: function(response) { window.setTimeout(function() { location.reload(); }, 1500); } }); } }); $('.btn_edit_address').click(function() { var addressId = $(this).attr('id'); if( addressId != '' ) { $.ajax({ url: "{{ url('fetch-address-details') }}", method: 'get', data: { addressId: addressId }, success: function(response) { if( response.status == 1 ) { $('#frm_update_address #address_id').val(addressId); $('#frm_update_address #address_1').val(response.data.address_1); $('#frm_update_address #address_2').val(response.data.address_2); $('#frm_update_address #town').val(response.data.town); $('#frm_update_address #county').val(response.data.county); $('#frm_update_address #zip').val(response.data.zip); $('#frm_update_address #phone').val(response.data.phone); $('#modal_edit_address').modal({ backdrop: 'static', keyboard: false }); } else { } } }); } }); $('#frm_update_address').validate({ errorPlacement: function(error, element) { if(element.parent('.input-group').length) { error.insertAfter(element.parent()); } else { error.insertAfter(element); } }, rules: { address_1: { required: true }, county: { required: true }, town: { required: true }, zip: { required: true }, phone: { phonenumber: true, minlength: 7, maxlength: 19 } }, messages: { address_1: { required: 'Please enter Address 1' }, county: { required: 'Please enter county' }, town: { required: 'Please enter town' }, zip: { required: 'Please enter post code' }, phone: { phonenumber: 'Please enter a valid phone number' } } }); $('#frm_update_address').submit(function(e) { e.preventDefault(); }); $('#btn_update_address').click(function(e) { if ($('#frm_update_address').valid()) { $.ajax({ url: "{{ url('update-address') }}", method: 'post', data: { address_id: $('#frm_update_address #address_id').val(), address_1: $('#frm_update_address #address_1').val(), address_2: $('#frm_update_address #address_2').val(), county: $('#frm_update_address #county').val(), town: $('#frm_update_address #town').val(), zip: $('#frm_update_address #zip').val(), phone: $('#frm_update_address #phone').val(), }, headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}', }, success: function(response) { Swal.fire({ showCancelButton: false, title: 'Updated!', text: "Your address has been updated.", type: 'success', showConfirmButton: false, timer: 1500 }); window.setTimeout(function() { location.reload(); }, 1500); } }); } }); $('.delete_address').click(function(e) { var refer = $(this); var addrId = $(refer).attr('data-product'); if (addrId != '') { e.preventDefault(); Swal.fire({ title: 'Are you sure?', text: "You won't be able to revert this!", type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Yes, delete it!' }).then((result) => { if (result.value) { Swal.fire({ title: 'Deleted!', text: "Your address has been deleted.", type: 'success', showConfirmButton: false, timer: 1500 }); $.ajax({ url: "{{ url('customer/'.auth()->user()->id.'/address/'.(isset($address->id) ? $address->id: null)) }}", method: "POST", data: { "_token": "{{ csrf_token() }}", _method: 'delete', addrId: addrId }, success:function(response) { setTimeout(function() { window.location.reload(); }, 1500); } }); } }); } }); }); </script> @endsection