Make email not required for customer/vendor
This commit is contained in:
		@@ -290,7 +290,7 @@
 | 
			
		||||
            modal += '                          <input class="form-control" placeholder="{{ trans('general.name') }}" required="required" name="name" type="text" id="name">';
 | 
			
		||||
            modal += '                      </div>';
 | 
			
		||||
            modal += '                  </div>';
 | 
			
		||||
            modal += '                  <div class="form-group col-md-6 required">';
 | 
			
		||||
            modal += '                  <div class="form-group col-md-6">';
 | 
			
		||||
            modal += '                      <label for="email" class="control-label">{{ trans('general.email') }}</label>';
 | 
			
		||||
            modal += '                      <div class="input-group">';
 | 
			
		||||
            modal += '                          <div class="input-group-addon"><i class="fa fa-envelope"></i></div>';
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@
 | 
			
		||||
        <div class="box-body">
 | 
			
		||||
            {{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('email', trans('general.email'), 'envelope') }}
 | 
			
		||||
            {{ Form::textGroup('email', trans('general.email'), 'envelope', []) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('tax_number', trans('general.tax_number'), 'percent', []) }}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
        <div class="box-body">
 | 
			
		||||
            {{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('email', trans('general.email'), 'envelope') }}
 | 
			
		||||
            {{ Form::textGroup('email', trans('general.email'), 'envelope', []) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('tax_number', trans('general.tax_number'), 'percent', []) }}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@
 | 
			
		||||
                @foreach($vendors as $item)
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <td><a href="{{ url('expenses/vendors/' . $item->id . '/edit') }}">{{ $item->name }}</a></td>
 | 
			
		||||
                        <td class="hidden-xs">{{ $item->email }}</td>
 | 
			
		||||
                        <td class="hidden-xs">{{ !empty($item->email) ? $item->email : 'N/A'}}</td>
 | 
			
		||||
                        <td>{{ $item->phone }}</td>
 | 
			
		||||
                        <td class="hidden-xs">
 | 
			
		||||
                            @if ($item->enabled)
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@
 | 
			
		||||
        <div class="box-body">
 | 
			
		||||
            {{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('email', trans('general.email'), 'envelope') }}
 | 
			
		||||
            {{ Form::textGroup('email', trans('general.email'), 'envelope', []) }}
 | 
			
		||||
 | 
			
		||||
            {{ Form::textGroup('tax_number', trans('general.tax_number'), 'percent', []) }}
 | 
			
		||||
 | 
			
		||||
@@ -68,7 +68,7 @@
 | 
			
		||||
            $('#create_user').iCheck({
 | 
			
		||||
                checkboxClass: 'icheckbox_square-green',
 | 
			
		||||
                radioClass: 'iradio_square-green',
 | 
			
		||||
                increaseArea: '20%' // optional
 | 
			
		||||
                increaseArea: '20%'
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $('#create_user').on('ifClicked', function (event) {
 | 
			
		||||
@@ -76,13 +76,29 @@
 | 
			
		||||
 | 
			
		||||
                if ($(this).prop('checked')) {
 | 
			
		||||
                    $('.col-md-6.password').addClass('hidden');
 | 
			
		||||
 | 
			
		||||
                    $('input[name="email"]').parent().parent().removeClass('has-error');
 | 
			
		||||
                    $('input[name="email"]').parent().parent().find('.help-block').remove();
 | 
			
		||||
                } else {
 | 
			
		||||
                    var email = $('input[name="email"]').val();
 | 
			
		||||
 | 
			
		||||
                    if (!email) {
 | 
			
		||||
                        $('input[name="email"]').parent().parent().addClass('has-error');
 | 
			
		||||
                        $('input[name="email"]').parent().after('<p class="help-block">{{ trans('validation.required', ['attribute' => 'email']) }}</p>');
 | 
			
		||||
                        $('input[name="email"]').focus();
 | 
			
		||||
 | 
			
		||||
                        return false;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    $.ajax({
 | 
			
		||||
                        url: '{{ url("auth/users/autocomplete") }}',
 | 
			
		||||
                        type: 'GET',
 | 
			
		||||
                        dataType: 'JSON',
 | 
			
		||||
                        data: {column: 'email', value: $('input[name="email"]').val()},
 | 
			
		||||
                        data: {column: 'email', value: email},
 | 
			
		||||
                        beforeSend: function() {
 | 
			
		||||
                            $('input[name="email"]').parent().parent().removeClass('has-error');
 | 
			
		||||
                            $('input[name="email"]').parent().parent().find('.help-block').remove();
 | 
			
		||||
 | 
			
		||||
                            $('.box-footer .btn').attr('disabled', true);
 | 
			
		||||
                        },
 | 
			
		||||
                        complete: function() {
 | 
			
		||||
@@ -90,6 +106,14 @@
 | 
			
		||||
                        },
 | 
			
		||||
                        success: function(json) {
 | 
			
		||||
                            if (json['errors']) {
 | 
			
		||||
                                if (json['data']) {
 | 
			
		||||
                                    $('input[name="email"]').parent().parent().addClass('has-error');
 | 
			
		||||
                                    $('input[name="email"]').parent().after('<p class="help-block">' + json['data'] + '</p>');
 | 
			
		||||
                                    $('input[name="email"]').focus();
 | 
			
		||||
 | 
			
		||||
                                    return false;
 | 
			
		||||
                                }
 | 
			
		||||
 | 
			
		||||
                                $('.col-md-6.password').removeClass('hidden');
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
    <div class="box-body">
 | 
			
		||||
        {{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
 | 
			
		||||
 | 
			
		||||
        {{ Form::textGroup('email', trans('general.email'), 'envelope') }}
 | 
			
		||||
        {{ Form::textGroup('email', trans('general.email'), 'envelope', []) }}
 | 
			
		||||
 | 
			
		||||
        {{ Form::textGroup('tax_number', trans('general.tax_number'), 'percent', []) }}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@
 | 
			
		||||
                @foreach($customers as $item)
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <td><a href="{{ url('incomes/customers/' . $item->id . '/edit') }}">{{ $item->name }}</a></td>
 | 
			
		||||
                        <td class="hidden-xs">{{ $item->email }}</td>
 | 
			
		||||
                        <td class="hidden-xs">{{ !empty($item->email) ? $item->email : 'N/A'}}</td>
 | 
			
		||||
                        <td>{{ $item->phone }}</td>
 | 
			
		||||
                        <td class="hidden-xs">
 | 
			
		||||
                            @if ($item->enabled)
 | 
			
		||||
 
 | 
			
		||||
@@ -291,7 +291,7 @@
 | 
			
		||||
            modal += '                          <input class="form-control" placeholder="{{ trans('general.name') }}" required="required" name="name" type="text" id="name">';
 | 
			
		||||
            modal += '                      </div>';
 | 
			
		||||
            modal += '                  </div>';
 | 
			
		||||
            modal += '                  <div class="form-group col-md-6 required">';
 | 
			
		||||
            modal += '                  <div class="form-group col-md-6">';
 | 
			
		||||
            modal += '                      <label for="email" class="control-label">{{ trans('general.email') }}</label>';
 | 
			
		||||
            modal += '                      <div class="input-group">';
 | 
			
		||||
            modal += '                          <div class="input-group-addon"><i class="fa fa-envelope"></i></div>';
 | 
			
		||||
 
 | 
			
		||||
@@ -163,7 +163,11 @@
 | 
			
		||||
                            @permission('update-incomes-invoices')
 | 
			
		||||
                            <li><a href="{{ url('incomes/invoices/' . $invoice->id . '/sent') }}">{{ trans('invoices.mark_sent') }}</a></li>
 | 
			
		||||
                            @endpermission
 | 
			
		||||
                            @if($invoice->customer_email)
 | 
			
		||||
                            <li><a href="{{ url('incomes/invoices/' . $invoice->id . '/email') }}">{{ trans('invoices.send_mail') }}</a></li>
 | 
			
		||||
                            @else
 | 
			
		||||
                            <li><a href="javascript:void(0);" class="green-tooltip disabled" data-toggle="tooltip" data-placement="right" title="{{ trans('invoices.messages.email_required') }}"><span class="text-disabled">{{ trans('invoices.send_mail') }}</span></a></li>
 | 
			
		||||
                            @endif
 | 
			
		||||
                            <li class="divider"></li>
 | 
			
		||||
                            <li><a href="{{ url('incomes/invoices/' . $invoice->id . '/pdf') }}">{{ trans('invoices.download_pdf') }}</a></li>
 | 
			
		||||
                            <li class="divider"></li>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user