diff --git a/app/Http/Controllers/ClientApiController.php b/app/Http/Controllers/ClientApiController.php index 4f4a6212d1e1..6cd91d1d09f1 100644 --- a/app/Http/Controllers/ClientApiController.php +++ b/app/Http/Controllers/ClientApiController.php @@ -67,7 +67,7 @@ class ClientApiController extends BaseAPIController $clients = $clients->paginate(); $transformer = new ClientTransformer(Auth::user()->account, Input::get('serializer')); - $paginator = Client::scope()->paginate(); + $paginator = Client::scope()->withTrashed()->paginate(); $data = $this->createCollection($clients, $transformer, ENTITY_CLIENT, $paginator); @@ -158,5 +158,45 @@ class ClientApiController extends BaseAPIController } + /** + * @SWG\Delete( + * path="/clients/{client_id}", + * tags={"client"}, + * summary="Delete a client", + * @SWG\Parameter( + * in="body", + * name="body", + * @SWG\Schema(ref="#/definitions/Client") + * ), + * @SWG\Response( + * response=200, + * description="Delete client", + * @SWG\Schema(type="object", @SWG\Items(ref="#/definitions/Client")) + * ), + * @SWG\Response( + * response="default", + * description="an ""unexpected"" error" + * ) + * ) + */ + + public function destroy($publicId) + { + + $client = Client::scope($publicId)->withTrashed()->first(); + $this->clientRepo->delete($client); + + $client = Client::scope($publicId) + ->with('country', 'contacts', 'industry', 'size', 'currency') + ->withTrashed() + ->first(); + + $transformer = new ClientTransformer(Auth::user()->account, Input::get('serializer')); + $data = $this->createItem($client, $transformer, ENTITY_CLIENT); + + return $this->response($data); + + } + } diff --git a/app/Http/Middleware/DuplicateSubmissionCheck.php b/app/Http/Middleware/DuplicateSubmissionCheck.php index 2468f7ac9b77..407ffab60071 100644 --- a/app/Http/Middleware/DuplicateSubmissionCheck.php +++ b/app/Http/Middleware/DuplicateSubmissionCheck.php @@ -7,6 +7,11 @@ class DuplicateSubmissionCheck // Prevent users from submitting forms twice public function handle($request, Closure $next) { + + if ($request->is('api/v1/*')) { + return $next($request); + } + $path = $request->path(); if (strpos($path, 'charts_and_reports') !== false) { diff --git a/app/Http/Requests/UpdateInvoiceRequest.php b/app/Http/Requests/UpdateInvoiceRequest.php index 68fa2acaa708..4b32bf4ccead 100644 --- a/app/Http/Requests/UpdateInvoiceRequest.php +++ b/app/Http/Requests/UpdateInvoiceRequest.php @@ -32,7 +32,7 @@ class UpdateInvoiceRequest extends Request $invoiceId = Invoice::getPrivateId($publicId); $rules = [ - 'invoice_items' => 'required|valid_invoice_items', + 'invoice_items' => 'valid_invoice_items', 'invoice_number' => 'unique:invoices,invoice_number,'.$invoiceId.',id,account_id,'.Auth::user()->account_id, 'discount' => 'positive', ]; diff --git a/app/Ninja/Repositories/AccountRepository.php b/app/Ninja/Repositories/AccountRepository.php index 0123b4c974f3..2170c34f25ad 100644 --- a/app/Ninja/Repositories/AccountRepository.php +++ b/app/Ninja/Repositories/AccountRepository.php @@ -75,21 +75,21 @@ class AccountRepository ->where('clients.deleted_at', '=', null) ->where('clients.account_id', '=', \Auth::user()->account_id) ->whereRaw("clients.name <> ''") - ->select(\DB::raw("'Clients' as type, clients.public_id, clients.name, '' as token")); + ->select(\DB::raw("'" . trans('texts.clients') . "' as type, clients.public_id, clients.name, '' as token")); $contacts = \DB::table('clients') ->join('contacts', 'contacts.client_id', '=', 'clients.id') ->where('clients.deleted_at', '=', null) ->where('clients.account_id', '=', \Auth::user()->account_id) ->whereRaw("CONCAT(contacts.first_name, contacts.last_name, contacts.email) <> ''") - ->select(\DB::raw("'Contacts' as type, clients.public_id, CONCAT(contacts.first_name, ' ', contacts.last_name, ' ', contacts.email) as name, '' as token")); + ->select(\DB::raw("'" . trans('texts.contacts') . "' as type, clients.public_id, CONCAT(contacts.first_name, ' ', contacts.last_name, ' ', contacts.email) as name, '' as token")); $invoices = \DB::table('clients') ->join('invoices', 'invoices.client_id', '=', 'clients.id') ->where('clients.account_id', '=', \Auth::user()->account_id) ->where('clients.deleted_at', '=', null) ->where('invoices.deleted_at', '=', null) - ->select(\DB::raw("'Invoices' as type, invoices.public_id, CONCAT(invoices.invoice_number, ': ', clients.name) as name, invoices.invoice_number as token")); + ->select(\DB::raw("'" . trans('texts.invoices') . "' as type, invoices.public_id, CONCAT(invoices.invoice_number, ': ', clients.name) as name, invoices.invoice_number as token")); $data = []; diff --git a/public/js/jquery.datetimepicker.js b/public/js/jquery.datetimepicker.js index 9c00413c2d4e..6d34e0e797cf 100644 --- a/public/js/jquery.datetimepicker.js +++ b/public/js/jquery.datetimepicker.js @@ -120,6 +120,14 @@ "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam" ] }, + 'fr-CA': { //French - Canada + months: [ + "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre" + ], + dayOfWeek: [ + "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam" + ] + }, es: { // Spanish months: [ "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" @@ -128,6 +136,14 @@ "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb" ] }, + 'es-ES': { // Spanish - Spain + months: [ + "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" + ], + dayOfWeek: [ + "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb" + ] + }, th: { // Thai months: [ 'มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม' @@ -200,6 +216,14 @@ "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" ] }, + 'nb_NO': { // Norwegian + months: [ + "Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember" + ], + dayOfWeek: [ + "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" + ] + }, ja: { // Japanese months: [ "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" diff --git a/resources/views/master.blade.php b/resources/views/master.blade.php index c85f6d5bbd61..e12c4bf7ee1f 100644 --- a/resources/views/master.blade.php +++ b/resources/views/master.blade.php @@ -77,11 +77,11 @@ } } ); - /* + var appLocale = '{{App::getLocale()}}'; + $.extend( true, $.fn.datepicker.defaults, { - language:'{{App::getLocale()}}' + language: appLocale.replace("_", "-") }); - */ @if (env('FACEBOOK_PIXEL')) @@ -202,4 +202,4 @@ - \ No newline at end of file +