From 8691d0ec26bfc65d6de4443d63b9c63c4f710aaf Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 24 Dec 2013 16:27:36 -0500 Subject: [PATCH] bug fixes --- app/controllers/AccountController.php | 8 +- app/controllers/ActivityController.php | 2 +- app/controllers/InvoiceController.php | 2 +- app/views/invoices/edit.blade.php | 19 ++- public/css/style.css | 182 +++++++++++++++++++++++++ public/js/script.js | 6 +- 6 files changed, 205 insertions(+), 14 deletions(-) create mode 100644 public/css/style.css diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index a590cce95a9e..f7cf4ca319fe 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -494,10 +494,10 @@ class AccountController extends \BaseController { } $user = Auth::user(); - $user->first_name = trim(Input::get('first_name')); - $user->last_name = trim(Input::get('last_name')); - $user->email = trim(Input::get('email')); - $user->password = trim(Input::get('password')); + $user->first_name = trim(Input::get('new_first_name')); + $user->last_name = trim(Input::get('new_last_name')); + $user->email = trim(Input::get('new_email')); + $user->password = trim(Input::get('new_password')); $user->registered = true; $user->save(); diff --git a/app/controllers/ActivityController.php b/app/controllers/ActivityController.php index 38c619239308..69404ab6277e 100755 --- a/app/controllers/ActivityController.php +++ b/app/controllers/ActivityController.php @@ -7,7 +7,7 @@ class ActivityController extends \BaseController { $clientId = Client::getPrivateId($clientPublicId); return Datatable::collection(Activity::scope()->where('client_id','=',$clientId)->get()) - ->addColumn('date', function($model) { return Utils::timestampToDateTimeString($model->created_at); }) + ->addColumn('date', function($model) { return Utils::timestampToDateTimeString(strtotime($model->created_at)); }) ->addColumn('message', function($model) { return $model->message; }) ->addColumn('balance', function($model) { return '$' . $model->balance; }) ->orderColumns('date') diff --git a/app/controllers/InvoiceController.php b/app/controllers/InvoiceController.php index 93107fe0db4f..07470dc42052 100755 --- a/app/controllers/InvoiceController.php +++ b/app/controllers/InvoiceController.php @@ -440,7 +440,7 @@ class InvoiceController extends \BaseController { $contact = $client->contacts()->where('is_primary', '=', true)->firstOrFail(); } - $inputClient = $input->client; + $inputClient = $input->client; $client->name = trim($inputClient->name); $client->work_phone = trim($inputClient->work_phone); $client->address1 = trim($inputClient->address1); diff --git a/app/views/invoices/edit.blade.php b/app/views/invoices/edit.blade.php index 8077fe4cb086..4d0c650595b5 100755 --- a/app/views/invoices/edit.blade.php +++ b/app/views/invoices/edit.blade.php @@ -54,7 +54,7 @@ {{ Former::text('end_date')->data_bind("value: end_date, valueUpdate: 'afterkeydown'") }}
- {{ Former::checkbox('recurring')->text('Enable | Learn more')->data_bind("checked: is_recurring") + {{ Former::checkbox('recurring')->text('Enable | Learn more')->data_bind("checked: is_recurring") ->inlineHelp($invoice && $invoice->last_sent_date ? 'Last invoice sent ' . Utils::timestampToDateString($invoice->last_sent_date) : '') }}
@if ($invoice && $invoice->recurring_invoice_id) @@ -68,6 +68,7 @@
{{ Former::text('po_number')->label('PO number')->data_bind("value: po_number, valueUpdate: 'afterkeydown'") }} {{ Former::text('discount')->data_bind("value: discount, valueUpdate: 'afterkeydown'") }} + {{ Former::text('currency')->data_bind("value: discount, valueUpdate: 'afterkeydown'") }}
@@ -208,8 +209,8 @@ {{ Former::text('city')->data_bind("value: city, valueUpdate: 'afterkeydown'") }} {{ Former::text('state')->data_bind("value: state, valueUpdate: 'afterkeydown'") }} {{ Former::text('postal_code')->data_bind("value: postal_code, valueUpdate: 'afterkeydown'") }} - {{ Former::select('country_id')->addOption('','')->label('Country') - ->fromQuery($countries, 'name', 'id')->data_bind("value: country_id") }} + {{ Former::select('country_id')->addOption('','')->label('Country')->addGroupClass('country_select') + ->fromQuery($countries, 'name', 'id')->data_bind("dropdown: country_id") }}
@@ -237,9 +238,9 @@
{{ Former::legend('Additional Info') }} - {{ Former::select('client_size_id')->addOption('','')->label('Size') + {{ Former::select('client_size_id')->addOption('','')->label('Size')->data_bind('value: client_size_id') ->fromQuery($clientSizes, 'name', 'id')->select($client ? $client->client_size_id : '') }} - {{ Former::select('client_industry_id')->addOption('','')->label('Industry') + {{ Former::select('client_industry_id')->addOption('','')->label('Industry')->data_bind('value: client_industry_id') ->fromQuery($clientIndustries, 'name', 'id')->select($client ? $client->client_industry_id : '') }} {{ Former::textarea('notes') }} @@ -267,6 +268,7 @@ $('form').change(refreshPDF); $('#country_id').combobox(); + $('[rel=tooltip]').tooltip(); $('#invoice_date').datepicker({ autoclose: true, @@ -289,6 +291,13 @@ } }).trigger('change'); + + $('.country_select input.form-control').on('change', function(e) { + var countryId = parseInt($('input[name=country_id]').val(), 10); + model.client.country_id(countryId); + }); + + @if ($client) $('#invoice_number').focus(); @else diff --git a/public/css/style.css b/public/css/style.css new file mode 100644 index 000000000000..dd775045ab63 --- /dev/null +++ b/public/css/style.css @@ -0,0 +1,182 @@ +/* +body > div.container { + min-height: 600px; +} +*/ + +label.checkbox, +label.control-label { + font-weight: normal !important; +} + + + + +div.panel { + padding-left: 0px !important; + padding-right: 0px !important; +} + +.form-actions { + margin: 0; + background-color: transparent; + text-align: center; +} + +/* +.form-horizontal { + max-width: 750px; + margin: 0 auto; +} +*/ + +/* +.form-group { + width: 50%; + margin: 0 auto; +} +*/ + +/* DataTables and BootStrap */ +.dataTables_wrapper { + padding-top: 16px; +} + +table.table thead > tr > th { + border-bottom-width: 0px; +} + +#DataTables_Table_0_length label { + font-weight: normal; + padding-bottom: 10px; +} + +div.dataTables_paginate.paging_bootstrap { + margin-top: -30px; +} + +/* +table.table tbody tr.odd { + background-color: #f9f9f9; +} + +table.table tbody tr:hover { + background-color: #f0f0f0 !important; +} +*/ + + +/* table sorting indicators */ +/*table.table thead .sorting { background: url('images/sort_both.png') no-repeat center right; }*/ +/* +table.table thead .sorting, +table.table thead .sorting_asc, +table.table thead .sorting_desc, +table.table thead .sorting_asc_disabled, +table.table thead .sorting_desc_disabled { + cursor: pointer; + *cursor: hand; +} + +table.table thead .sorting_asc { background: url('images/sort_asc.png') no-repeat center right; } +table.table thead .sorting_desc { background: url('images/sort_desc.png') no-repeat center right; } + + +table.table thead .sorting_asc_disabled { background: url('images/sort_asc_disabled.png') no-repeat center right; } +table.table thead .sorting_desc_disabled { background: url('images/sort_desc_disabled.png') no-repeat center right; } +*/ + + +/* Hover nav */ +.sidebar-nav { + padding: 9px 0; +} + +.dropdown-menu .sub-menu { + left: 100%; + position: absolute; + top: 0; + visibility: hidden; + margin-top: -1px; +} + +.dropdown-menu li:hover .sub-menu { + visibility: visible; +} + +.dropdown:hover .dropdown-menu { + display: block; +} + +.nav-tabs .dropdown-menu, .nav-pills .dropdown-menu, .navbar .dropdown-menu { + margin-top: 0; +} + +.navbar .sub-menu:before { + border-bottom: 7px solid transparent; + border-left: none; + border-right: 7px solid rgba(0, 0, 0, 0.2); + border-top: 7px solid transparent; + left: -7px; + top: 10px; +} +.navbar .sub-menu:after { + border-top: 6px solid transparent; + border-left: none; + border-right: 6px solid #fff; + border-bottom: 6px solid transparent; + left: 10px; + top: 11px; + left: -6px; +} + + +.invoice-table { + border-style: none !important; +} + +/* +table.invoice-table tbody tr:hover { + background-color: #FFFFFF !important; +} +*/ + +.invoice-table td { + padding: 2px !important; +} + +.invoice-table td input, +.invoice-table td textarea { + border: none !important; + width: 100%; +} + +.invoice-table th { + border-top: 1px solid #ddd !important; +} + +.invoice-table td.hide-border, +.invoice-table th.hide-border { + border-style: none !important; +} + +.invoice-table td.td-icon { + vertical-align: middle !important; +} + +.fa-bars { + cursor: move !important; +} + +.closer-row { + margin-bottom: 2px; +} + + +/* Animate col width changes */ +.row div { + -webkit-transition: width 0.5s ease, margin 0.5s ease; + -moz-transition: width 0.5s ease, margin 0.5s ease; + -o-transition: width 0.5s ease, margin 0.5s ease; + transition: width 0.5s ease, margin 0.5s ease; +} \ No newline at end of file diff --git a/public/js/script.js b/public/js/script.js index 7ddbfed622fc..f77d5e362927 100755 --- a/public/js/script.js +++ b/public/js/script.js @@ -108,7 +108,7 @@ function generatePDF(invoice) { var productKey = item.product_key; // show at most one blank line - if (shownItem && !cost && !qty && !notes && !productKey) { + if (shownItem && (!cost || cost == '0.00') && !qty && !notes && !productKey) { continue; } shownItem = true; @@ -579,7 +579,7 @@ ko.bindingHandlers.dropdown = { init: function (element, valueAccessor, allBindingsAccessor) { var options = allBindingsAccessor().dropdownOptions|| {}; var value = ko.utils.unwrapObservable(valueAccessor()); - var id = (value && value.public_id) ? value.public_id() : (value && value.id) ? value.id() : false; + var id = (value && value.public_id) ? value.public_id() : (value && value.id) ? value.id() : value ? value : false; if (id) $(element).val(id); console.log("combo-init: %s", id); $(element).combobox(options); @@ -595,7 +595,7 @@ ko.bindingHandlers.dropdown = { }, update: function (element, valueAccessor) { var value = ko.utils.unwrapObservable(valueAccessor()); - var id = (value && value.public_id) ? value.public_id() : (value && value.id) ? value.id() : false; + var id = (value && value.public_id) ? value.public_id() : (value && value.id) ? value.id() : value ? value : false; console.log("combo-update: %s", id); if (id) $(element).val(id); $(element).combobox('refresh');