Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
f2f636c5dd
@ -78,5 +78,4 @@ class BillReminder extends Command
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ class InvoiceReminder extends Command
|
||||
|
||||
foreach ($invoices as $invoice) {
|
||||
// Notify the customer
|
||||
if ($invoice->customer) {
|
||||
if ($invoice->customer && !empty($invoice->customer_email)) {
|
||||
$invoice->customer->notify(new Notification($invoice));
|
||||
}
|
||||
|
||||
@ -83,5 +83,4 @@ class InvoiceReminder extends Command
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -243,6 +243,7 @@ class Users extends Controller
|
||||
public function autocomplete(ARequest $request)
|
||||
{
|
||||
$user = false;
|
||||
$data = false;
|
||||
|
||||
$column = $request['column'];
|
||||
$value = $request['value'];
|
||||
@ -250,7 +251,7 @@ class Users extends Controller
|
||||
if (!empty($column) && !empty($value)) {
|
||||
switch ($column) {
|
||||
case 'id':
|
||||
$user = User::find();
|
||||
$user = User::find((int) $value);
|
||||
break;
|
||||
case 'email':
|
||||
$user = User::where('email', $value)->first();
|
||||
@ -258,12 +259,16 @@ class Users extends Controller
|
||||
default:
|
||||
$user = User::where($column, $value)->first();
|
||||
}
|
||||
|
||||
$data = $user;
|
||||
} elseif (!empty($column) && empty($value)) {
|
||||
$data = trans('validation.required', ['attribute' => $column]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'errors' => ($user) ? false: true,
|
||||
'success' => ($user) ? true: false,
|
||||
'data' => $user
|
||||
'errors' => ($user) ? false : true,
|
||||
'success' => ($user) ? true : false,
|
||||
'data' => $data
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
92
app/Http/Controllers/Customers/Profile.php
Normal file
92
app/Http/Controllers/Customers/Profile.php
Normal file
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Customers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Customer\Profile as Request;
|
||||
use App\Models\Auth\User;
|
||||
|
||||
class Profile extends Controller
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
return $this->edit();
|
||||
}
|
||||
|
||||
public function show()
|
||||
{
|
||||
return $this->edit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
return view('customers.profile.edit', compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function update(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
// Upload picture
|
||||
$picture = $request->file('picture');
|
||||
if ($picture && $picture->isValid()) {
|
||||
$request['picture'] = $picture->store('users');
|
||||
}
|
||||
|
||||
// Do not reset password if not entered/changed
|
||||
if (empty($request['password'])) {
|
||||
unset($request['password']);
|
||||
unset($request['password_confirmation']);
|
||||
}
|
||||
|
||||
// Update user
|
||||
$user->update($request->input());
|
||||
|
||||
// Update customer
|
||||
$user->customer->update($request->input());
|
||||
|
||||
$message = trans('messages.success.updated', ['type' => trans('auth.profile')]);
|
||||
|
||||
flash($message)->success();
|
||||
|
||||
return redirect('customers/profile/edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark overdue invoices notifications are read and redirect to invoices page.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function readOverdueInvoices()
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
// Mark invoice notifications as read
|
||||
foreach ($user->unreadNotifications as $notification) {
|
||||
// Not an invoice notification
|
||||
if ($notification->getAttribute('type') != 'App\Notifications\Income\Invoice') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$notification->markAsRead();
|
||||
}
|
||||
|
||||
// Redirect to invoices
|
||||
return redirect('customers/invoices');
|
||||
}
|
||||
}
|
@ -44,6 +44,10 @@ class Vendors extends Controller
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
if (empty($request['email'])) {
|
||||
$request['email'] = '';
|
||||
}
|
||||
|
||||
Vendor::create($request->all());
|
||||
|
||||
$message = trans('messages.success.added', ['type' => trans_choice('general.vendors', 1)]);
|
||||
@ -120,6 +124,10 @@ class Vendors extends Controller
|
||||
*/
|
||||
public function update(Vendor $vendor, Request $request)
|
||||
{
|
||||
if (empty($request['email'])) {
|
||||
$request['email'] = '';
|
||||
}
|
||||
|
||||
$vendor->update($request->all());
|
||||
|
||||
$message = trans('messages.success.updated', ['type' => trans_choice('general.vendors', 1)]);
|
||||
@ -169,6 +177,10 @@ class Vendors extends Controller
|
||||
|
||||
public function vendor(Request $request)
|
||||
{
|
||||
if (empty($request['email'])) {
|
||||
$request['email'] = '';
|
||||
}
|
||||
|
||||
$vendor = Vendor::create($request->all());
|
||||
|
||||
return response()->json($vendor);
|
||||
|
@ -46,6 +46,10 @@ class Customers extends Controller
|
||||
public function store(Request $request)
|
||||
{
|
||||
if (empty($request->input('create_user'))) {
|
||||
if (empty($request['email'])) {
|
||||
$request['email'] = '';
|
||||
}
|
||||
|
||||
Customer::create($request->all());
|
||||
} else {
|
||||
// Check if user exist
|
||||
@ -112,6 +116,11 @@ class Customers extends Controller
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$data = $row->toArray();
|
||||
|
||||
if (empty($data['email'])) {
|
||||
$data['email'] = '';
|
||||
}
|
||||
|
||||
$data['company_id'] = session('company_id');
|
||||
|
||||
Customer::create($data);
|
||||
@ -149,6 +158,10 @@ class Customers extends Controller
|
||||
public function update(Customer $customer, Request $request)
|
||||
{
|
||||
if (empty($request->input('create_user'))) {
|
||||
if (empty($request['email'])) {
|
||||
$request['email'] = '';
|
||||
}
|
||||
|
||||
$customer->update($request->all());
|
||||
} else {
|
||||
// Check if user exist
|
||||
@ -220,6 +233,10 @@ class Customers extends Controller
|
||||
|
||||
public function customer(Request $request)
|
||||
{
|
||||
if (empty($request['email'])) {
|
||||
$request['email'] = '';
|
||||
}
|
||||
|
||||
$customer = Customer::create($request->all());
|
||||
|
||||
return response()->json($customer);
|
||||
|
@ -489,6 +489,10 @@ class Invoices extends Controller
|
||||
*/
|
||||
public function emailInvoice(Invoice $invoice)
|
||||
{
|
||||
if (empty($invoice->customer_email)) {
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
$invoice = $this->prepareInvoice($invoice);
|
||||
|
||||
$logo = $this->getLogo();
|
||||
@ -584,18 +588,23 @@ class Invoices extends Controller
|
||||
|
||||
$amount = $invoice->amount - $paid;
|
||||
|
||||
$request = new PaymentRequest();
|
||||
if (!empty($amount)) {
|
||||
$request = new PaymentRequest();
|
||||
|
||||
$request['company_id'] = $invoice->company_id;
|
||||
$request['invoice_id'] = $invoice->id;
|
||||
$request['account_id'] = setting('general.default_account');
|
||||
$request['payment_method'] = setting('general.default_payment_method', 'offlinepayment.cash.1');
|
||||
$request['currency_code'] = $invoice->currency_code;
|
||||
$request['amount'] = $amount;
|
||||
$request['paid_at'] = Date::now();
|
||||
$request['_token'] = csrf_token();
|
||||
$request['company_id'] = $invoice->company_id;
|
||||
$request['invoice_id'] = $invoice->id;
|
||||
$request['account_id'] = setting('general.default_account');
|
||||
$request['payment_method'] = setting('general.default_payment_method', 'offlinepayment.cash.1');
|
||||
$request['currency_code'] = $invoice->currency_code;
|
||||
$request['amount'] = $amount;
|
||||
$request['paid_at'] = Date::now();
|
||||
$request['_token'] = csrf_token();
|
||||
|
||||
$this->payment($request);
|
||||
$this->payment($request);
|
||||
} else {
|
||||
$invoice->invoice_status_code = 'paid';
|
||||
$invoice->save();
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
@ -689,7 +698,9 @@ class Invoices extends Controller
|
||||
{
|
||||
$invoice = Invoice::find($payment->invoice_id);
|
||||
|
||||
if ($invoice->payments()->count() > 1) {
|
||||
if ($invoice->payments()->paid() == $invoice->amount) {
|
||||
$invoice->invoice_status_code = 'paid';
|
||||
} elseif ($invoice->payments()->count() > 1) {
|
||||
$invoice->invoice_status_code = 'partial';
|
||||
} else {
|
||||
$invoice->invoice_status_code = 'draft';
|
||||
|
35
app/Http/Requests/Customer/Profile.php
Normal file
35
app/Http/Requests/Customer/Profile.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Customer;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class Profile extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$id = auth()->user()->getAttribute('id');
|
||||
|
||||
return [
|
||||
'name' => 'required|string',
|
||||
'email' => 'required|email|unique:users,email,' . $id . ',id,deleted_at,NULL',
|
||||
'password' => 'confirmed',
|
||||
'picture' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024,
|
||||
];
|
||||
}
|
||||
}
|
@ -23,6 +23,11 @@ class Vendor extends Request
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$email = '';
|
||||
|
||||
// Get company id
|
||||
$company_id = $this->request->get('company_id');
|
||||
|
||||
// Check if store or update
|
||||
if ($this->getMethod() == 'PATCH') {
|
||||
$id = $this->vendor->getAttribute('id');
|
||||
@ -30,12 +35,13 @@ class Vendor extends Request
|
||||
$id = null;
|
||||
}
|
||||
|
||||
// Get company id
|
||||
$company_id = $this->request->get('company_id');
|
||||
if (!empty($this->request->get('email'))) {
|
||||
$email = 'email|unique:vendors,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL';
|
||||
}
|
||||
|
||||
return [
|
||||
'name' => 'required|string',
|
||||
'email' => 'required|email|unique:vendors,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL',
|
||||
'email' => $email,
|
||||
'currency_code' => 'required|string',
|
||||
];
|
||||
}
|
||||
|
@ -23,8 +23,12 @@ class Customer extends Request
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$email = '';
|
||||
$required = '';
|
||||
|
||||
// Get company id
|
||||
$company_id = $this->request->get('company_id');
|
||||
|
||||
// Check if store or update
|
||||
if ($this->getMethod() == 'PATCH') {
|
||||
$id = $this->customer->getAttribute('id');
|
||||
@ -36,12 +40,13 @@ class Customer extends Request
|
||||
$required = 'required|';
|
||||
}
|
||||
|
||||
// Get company id
|
||||
$company_id = $this->request->get('company_id');
|
||||
if (!empty($this->request->get('email'))) {
|
||||
$email = 'email|unique:customers,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL';
|
||||
}
|
||||
|
||||
return [
|
||||
'name' => 'required|string',
|
||||
'email' => 'required|email|unique:customers,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL',
|
||||
'email' => $email,
|
||||
'currency_code' => 'required|string',
|
||||
'password' => $required . 'confirmed',
|
||||
];
|
||||
|
@ -13,9 +13,9 @@ trait Currencies
|
||||
$default = new Currency(setting('general.default_currency', 'USD'));
|
||||
|
||||
if ($format) {
|
||||
$money = Money::$code($amount, true)->convert($default, $rate)->format();
|
||||
$money = Money::$code($amount, true)->convert($default, (double) $rate)->format();
|
||||
} else {
|
||||
$money = Money::$code($amount)->convert($default, $rate)->getAmount();
|
||||
$money = Money::$code($amount)->convert($default, (double) $rate)->getAmount();
|
||||
}
|
||||
|
||||
return $money;
|
||||
@ -28,9 +28,9 @@ trait Currencies
|
||||
$code = new Currency($code);
|
||||
|
||||
if ($format) {
|
||||
$money = Money::$default($amount, true)->convert($code, $rate)->format();
|
||||
$money = Money::$default($amount, true)->convert($code, (double) $rate)->format();
|
||||
} else {
|
||||
$money = Money::$default($amount)->convert($code, $rate)->getAmount();
|
||||
$money = Money::$default($amount)->convert($code, (double) $rate)->getAmount();
|
||||
}
|
||||
|
||||
return $money;
|
||||
@ -41,9 +41,9 @@ trait Currencies
|
||||
$code = new Currency($code);
|
||||
|
||||
if ($format) {
|
||||
$money = Money::$default($amount, true)->convert($code, $rate)->format();
|
||||
$money = Money::$default($amount, true)->convert($code, (double) $rate)->format();
|
||||
} else {
|
||||
$money = Money::$default($amount)->convert($code, $rate)->getAmount();
|
||||
$money = Money::$default($amount)->convert($code, (double) $rate)->getAmount();
|
||||
}
|
||||
|
||||
return $money;
|
||||
|
12
public/css/app.css
vendored
12
public/css/app.css
vendored
@ -498,6 +498,18 @@ ul.add-new.nav.navbar-nav.pull-left {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
.text-disabled {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.tooltip > .tooltip-inner {
|
||||
background-color: #6da252;
|
||||
}
|
||||
|
||||
.tooltip.right .tooltip-arrow {
|
||||
border-right-color: #6da252 !important;
|
||||
}
|
||||
/*
|
||||
.content-wrapper {
|
||||
overflow: inherit;
|
||||
|
@ -37,8 +37,9 @@ return [
|
||||
],
|
||||
|
||||
'messages' => [
|
||||
'email_sent' => 'Invoice email has been sent successfully!',
|
||||
'marked_sent' => 'Invoice marked as sent successfully!',
|
||||
'email_sent' => 'Invoice email has been sent successfully!',
|
||||
'marked_sent' => 'Invoice marked as sent successfully!',
|
||||
'email_required' => 'No email address for this customer!',
|
||||
],
|
||||
|
||||
'notification' => [
|
||||
|
69
resources/views/customers/profile/edit.blade.php
Normal file
69
resources/views/customers/profile/edit.blade.php
Normal file
@ -0,0 +1,69 @@
|
||||
@extends('layouts.customer')
|
||||
|
||||
@section('title', trans('general.title.edit', ['type' => trans('auth.profile')]))
|
||||
|
||||
@section('content')
|
||||
<!-- Default box -->
|
||||
<div class="box box-success">
|
||||
{!! Form::model($user, [
|
||||
'method' => 'PATCH',
|
||||
'files' => true,
|
||||
'url' => ['customers/profile/update'],
|
||||
'role' => 'form'
|
||||
]) !!}
|
||||
|
||||
<div class="box-body">
|
||||
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
|
||||
|
||||
{{ Form::emailGroup('email', trans('general.email'), 'envelope') }}
|
||||
|
||||
{{ Form::textGroup('tax_number', trans('general.tax_number'), 'percent', []) }}
|
||||
|
||||
{{ Form::textGroup('phone', trans('general.phone'), 'phone', []) }}
|
||||
|
||||
{{ Form::textareaGroup('address', trans('general.address')) }}
|
||||
|
||||
{{ Form::passwordGroup('password', trans('auth.password.current'), 'key', []) }}
|
||||
|
||||
{{ Form::passwordGroup('password_confirmation', trans('auth.password.current_confirm'), 'key', []) }}
|
||||
|
||||
{{ Form::selectGroup('locale', trans_choice('general.languages', 1), 'flag', language()->allowed()) }}
|
||||
|
||||
{{ Form::fileGroup('picture', trans_choice('general.pictures', 1)) }}
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
|
||||
@permission(['update-customers-profile'])
|
||||
<div class="box-footer">
|
||||
{{ Form::saveButtons('customers') }}
|
||||
</div>
|
||||
<!-- /.box-footer -->
|
||||
@endpermission
|
||||
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('public/js/bootstrap-fancyfile.js') }}"></script>
|
||||
@endpush
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('public/css/bootstrap-fancyfile.css') }}">
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$("#locale").select2({
|
||||
placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.languages', 1)]) }}"
|
||||
});
|
||||
|
||||
$('#picture').fancyfile({
|
||||
text : '{{ trans('general.form.select.file') }}',
|
||||
style : 'btn-default',
|
||||
placeholder : '<?php echo $user->picture; ?>'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
@ -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>';
|
||||
|
@ -389,7 +389,7 @@
|
||||
html += ' <h4 class="modal-title" id="emailModalLabel">Overflowing text</h4>';
|
||||
html += ' </div>';
|
||||
html += ' <div class="modal-body">';
|
||||
html += ' N/A';
|
||||
html += ' {{ trans('general.na') }}';
|
||||
html += ' </div>';
|
||||
html += ' <div class="modal-footer">';
|
||||
html += ' <button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('general.cancel') }}</button>';
|
||||
|
@ -47,7 +47,7 @@
|
||||
<tr>
|
||||
<td><a href="{{ url('expenses/payments/' . $item->id . '/edit') }}">{{ Date::parse($item->paid_at)->format($date_format) }}</a></td>
|
||||
<td>@money($item->amount, $item->currency_code, true)</td>
|
||||
<td class="hidden-xs">{{ !empty($item->vendor->name) ? $item->vendor->name : 'N/A'}}</td>
|
||||
<td class="hidden-xs">{{ !empty($item->vendor->name) ? $item->vendor->name : trans('general.na') }}</td>
|
||||
<td class="hidden-xs">{{ $item->category->name }}</td>
|
||||
<td class="hidden-xs">{{ $item->account->name }}</td>
|
||||
<td class="text-center">
|
||||
|
@ -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 : trans('general.na') }}</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 : trans('general.na') }}</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>';
|
||||
|
@ -157,13 +157,19 @@
|
||||
@permission('update-incomes-invoices')
|
||||
<li><a href="{{ url('incomes/invoices/' . $invoice->id . '/pay') }}">{{ trans('invoices.mark_paid') }}</a></li>
|
||||
@endpermission
|
||||
@if(empty($invoice->payments()->count()) || (!empty($invoice->payments()->count()) && $invoice->payments()->paid() != $invoice->amount))
|
||||
<li><a href="#" id="button-payment">{{ trans('invoices.add_payment') }}</a></li>
|
||||
@endif
|
||||
<li class="divider"></li>
|
||||
@endif
|
||||
@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>
|
||||
@ -394,7 +400,7 @@
|
||||
html += ' <h4 class="modal-title" id="emailModalLabel">Overflowing text</h4>';
|
||||
html += ' </div>';
|
||||
html += ' <div class="modal-body">';
|
||||
html += ' N/A';
|
||||
html += ' {{ trans('general.na') }}';
|
||||
html += ' </div>';
|
||||
html += ' <div class="modal-footer">';
|
||||
html += ' <button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('general.cancel') }}</button>';
|
||||
|
@ -47,7 +47,7 @@
|
||||
<tr>
|
||||
<td><a href="{{ url('incomes/revenues/' . $item->id . '/edit') }}">{{ Date::parse($item->paid_at)->format($date_format) }}</a></td>
|
||||
<td>@money($item->amount, $item->currency_code, true)</td>
|
||||
<td class="hidden-xs">{{ !empty($item->customer->name) ? $item->customer->name : 'N/A'}}</td>
|
||||
<td class="hidden-xs">{{ !empty($item->customer->name) ? $item->customer->name : trans('general.na') }}</td>
|
||||
<td class="hidden-xs">{{ $item->category->name }}</td>
|
||||
<td class="hidden-xs">{{ $item->account->name }}</td>
|
||||
<td class="text-center">
|
||||
|
@ -31,17 +31,10 @@
|
||||
<li>
|
||||
<!-- inner menu: contains the actual data -->
|
||||
<ul class="menu">
|
||||
@if (count($bills))
|
||||
<li>
|
||||
<a href="{{ url('auth/users/' . $user->id . '/read-bills') }}">
|
||||
<i class="fa fa-shopping-cart text-red"></i> {{ trans_choice('header.notifications.upcoming_bills', count($bills), ['count' => count($bills)]) }}
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
@if (count($invoices))
|
||||
<li>
|
||||
<a href="{{ url('auth/users/' . $user->id . '/read-invoices') }}">
|
||||
<i class="fa fa-money text-green"></i> {{ trans_choice('header.notifications.overdue_invoices', count($invoices), ['count' => count($invoices)]) }}
|
||||
<a href="{{ url('customers/profile/read-invoices') }}">
|
||||
<i class="fa fa-money text-red"></i> {{ trans_choice('header.notifications.overdue_invoices', count($invoices), ['count' => count($invoices)]) }}
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
@ -92,9 +85,9 @@
|
||||
</li>
|
||||
<!-- Menu Footer-->
|
||||
<li class="user-footer">
|
||||
@permission('read-customers-profile')
|
||||
@permission('update-customers-profile')
|
||||
<div class="pull-left">
|
||||
<a href="{{ url('auth/users/' . $user->id . '/edit') }}" class="btn btn-default btn-flat">{{ trans('auth.profile') }}</a>
|
||||
<a href="{{ url('customers/profile/edit') }}" class="btn btn-default btn-flat">{{ trans('auth.profile') }}</a>
|
||||
</div>
|
||||
@endpermission
|
||||
<div class="pull-right">
|
||||
|
@ -151,6 +151,8 @@ Route::group(['middleware' => 'language'], function () {
|
||||
Route::resource('invoices', 'Customers\Invoices');
|
||||
Route::resource('payments', 'Customers\Payments');
|
||||
Route::resource('transactions', 'Customers\Transactions');
|
||||
Route::get('profile/read-invoices', 'Customers\Profile@readOverdueInvoices');
|
||||
Route::resource('profile', 'Customers\Profile');
|
||||
|
||||
Route::get('logout', 'Auth\Login@destroy')->name('customer_logout');
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user