1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-19 16:01:34 +02:00

Prevent checkboxes from being checked if validation fails

This commit is contained in:
Hillel Coren 2017-01-09 17:01:51 +02:00
parent ff3e23e7da
commit a3c2340fa0
21 changed files with 111 additions and 64 deletions

View File

@ -30,7 +30,7 @@
'push_checkboxes' => true,
// The value a checkbox will have in the POST array if unchecked
'unchecked_value' => 0,
'unchecked_value' => "0",
// Required fields
////////////////////////////////////////////////////////////////////

View File

@ -18,8 +18,8 @@
{!! Former::populateField('show_address', intval($accountGateway->show_address)) !!}
{!! Former::populateField('update_address', intval($accountGateway->update_address)) !!}
{!! Former::populateField('publishable_key', $accountGateway->getPublishableStripeKey() ? str_repeat('*', strlen($accountGateway->getPublishableStripeKey())) : '') !!}
{!! Former::populateField('enable_ach', $accountGateway->getAchEnabled() ? '1' : null) !!}
{!! Former::populateField('enable_paypal', $accountGateway->getPayPalEnabled() ? '1' : null) !!}
{!! Former::populateField('enable_ach', $accountGateway->getAchEnabled() ? 1 : 0) !!}
{!! Former::populateField('enable_paypal', $accountGateway->getPayPalEnabled() ? 1 : 0) !!}
{!! Former::populateField('plaid_client_id', $accountGateway->getPlaidClientId() ? str_repeat('*', strlen($accountGateway->getPlaidClientId())) : '') !!}
{!! Former::populateField('plaid_secret', $accountGateway->getPlaidSecret() ? str_repeat('*', strlen($accountGateway->getPlaidSecret())) : '') !!}
{!! Former::populateField('plaid_public_key', $accountGateway->getPlaidPublicKey() ? str_repeat('*', strlen($accountGateway->getPlaidPublicKey())) : '') !!}
@ -77,7 +77,7 @@
&& isset($_ENV['DWOLLA_KEY']) && isset($_ENV['DWOLLA_SECRET']))
{{-- do nothing --}}
@elseif ($field == 'testMode' || $field == 'developerMode' || $field == 'sandbox')
{!! Former::checkbox($gateway->id.'_'.$field)->label(ucwords(Utils::toSpaceCase($field)))->text('Enable')->value('true') !!}
{!! Former::checkbox($gateway->id.'_'.$field)->label(ucwords(Utils::toSpaceCase($field)))->text('Enable')->value(1) !!}
@elseif ($field == 'username' || $field == 'password')
{!! Former::text($gateway->id.'_'.$field)->label('API '. ucfirst(Utils::toSpaceCase($field))) !!}
@elseif ($gateway->isCustom() && $field == 'text')
@ -115,7 +115,8 @@
'link'=>'<a href="https://articles.braintreepayments.com/guides/paypal/setup-guide" target="_blank">'.
trans('texts.braintree_paypal_help_link_text').'</a>'
]))
->text(trans('texts.braintree_enable_paypal')) !!}
->text(trans('texts.braintree_enable_paypal'))
->value(1) !!}
@endif
@endif
@ -135,17 +136,21 @@
{!! Former::checkbox('show_address')
->label(trans('texts.billing_address'))
->text(trans('texts.show_address_help'))
->addGroupClass('gateway-option') !!}
->addGroupClass('gateway-option')
->value(1) !!}
{!! Former::checkbox('update_address')
->label(' ')
->text(trans('texts.update_address_help'))
->addGroupClass('gateway-option') !!}
->addGroupClass('gateway-option')
->value(1) !!}
{!! Former::checkboxes('creditCardTypes[]')
->label('Accepted Credit Cards')
->checkboxes($creditCardTypes)
->class('creditcard-types')
->addGroupClass('gateway-option')
->value(1)
!!}
</div>
@ -154,7 +159,8 @@
{!! Former::checkbox('enable_ach')
->label(trans('texts.ach'))
->text(trans('texts.enable_ach'))
->help(trans('texts.stripe_ach_help')) !!}
->help(trans('texts.stripe_ach_help'))
->value(1) !!}
<div class="stripe-ach-options">
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
@ -171,7 +177,8 @@
@elseif ($accountGateway && $accountGateway->gateway_id == GATEWAY_WEPAY)
{!! Former::checkbox('enable_ach')
->label(trans('texts.ach'))
->text(trans('texts.enable_ach')) !!}
->text(trans('texts.enable_ach'))
->value(1) !!}
@endif
</div>

View File

@ -50,23 +50,28 @@
</div>
<div id="wepay-accept-debit">
{!! Former::checkbox('debit_cards')
->text(trans('texts.accept_debit_cards')) !!}
->text(trans('texts.accept_debit_cards'))
->value(1) !!}
</div>
@endif
{!! Former::checkbox('show_address')
->label(trans('texts.billing_address'))
->text(trans('texts.show_address_help')) !!}
->text(trans('texts.show_address_help'))
->value(1) !!}
{!! Former::checkbox('update_address')
->label(' ')
->text(trans('texts.update_address_help')) !!}
->text(trans('texts.update_address_help'))
->value(1) !!}
{!! Former::checkboxes('creditCardTypes[]')
->label('Accepted Credit Cards')
->checkboxes($creditCardTypes)
->class('creditcard-types') !!}
->class('creditcard-types')
->value(1) !!}
{!! Former::checkbox('enable_ach')
->label(trans('texts.ach'))
->text(trans('texts.enable_ach')) !!}
->text(trans('texts.enable_ach'))
->value(1) !!}
{!! Former::checkbox('tos_agree')->label(' ')->text(trans('texts.wepay_tos_agree',
['link'=>'<a id="wepay-tos-link" href="https://go.wepay.com/terms-of-service-us" target="_blank">'.trans('texts.wepay_tos_link_text').'</a>']

View File

@ -53,12 +53,14 @@
<div class="col-md-10 col-md-offset-1">
{!! Former::checkbox('enable_client_portal')
->text(trans('texts.enable'))
->help(trans('texts.enable_client_portal_help')) !!}
->help(trans('texts.enable_client_portal_help'))
->value(1) !!}
</div>
<div class="col-md-10 col-md-offset-1">
{!! Former::checkbox('enable_client_portal_dashboard')
->text(trans('texts.enable'))
->help(trans('texts.enable_client_portal_dashboard_help')) !!}
->help(trans('texts.enable_client_portal_dashboard_help'))
->value(1) !!}
</div>
</div>
</div>
@ -83,13 +85,15 @@
{!! Former::checkbox('enable_portal_password')
->text(trans('texts.enable'))
->help(trans('texts.enable_portal_password_help'))
->label(trans('texts.enable_portal_password')) !!}
->label(trans('texts.enable_portal_password'))
->value(1) !!}
</div>
<div class="col-md-10 col-md-offset-1">
{!! Former::checkbox('send_portal_password')
->text(trans('texts.enable'))
->help(trans('texts.send_portal_password_help'))
->label(trans('texts.send_portal_password')) !!}
->label(trans('texts.send_portal_password'))
->value(1) !!}
</div>
</div>
</div>
@ -101,13 +105,15 @@
{!! Former::checkbox('show_accept_invoice_terms')
->text(trans('texts.enable'))
->help(trans('texts.show_accept_invoice_terms_help'))
->label(trans('texts.show_accept_invoice_terms')) !!}
->label(trans('texts.show_accept_invoice_terms'))
->value(1) !!}
</div>
<div class="col-md-10 col-md-offset-1">
{!! Former::checkbox('show_accept_quote_terms')
->text(trans('texts.enable'))
->help(trans('texts.show_accept_quote_terms_help'))
->label(trans('texts.show_accept_quote_terms')) !!}
->label(trans('texts.show_accept_quote_terms'))
->value(1) !!}
</div>
</div>
</div>
@ -119,13 +125,15 @@
{!! Former::checkbox('require_invoice_signature')
->text(trans('texts.enable'))
->help(trans('texts.require_invoice_signature_help'))
->label(trans('texts.require_invoice_signature')) !!}
->label(trans('texts.require_invoice_signature'))
->value(1) !!}
</div>
<div class="col-md-10 col-md-offset-1">
{!! Former::checkbox('require_quote_signature')
->text(trans('texts.enable'))
->help(trans('texts.require_quote_signature_help'))
->label(trans('texts.require_quote_signature')) !!}
->label(trans('texts.require_quote_signature'))
->value(1) !!}
</div>
</div>
</div>
@ -146,7 +154,8 @@
{!! Former::checkbox('enable_buy_now_buttons')
->text(trans('texts.enable'))
->label(' ')
->help(trans('texts.enable_buy_now_buttons_help')) !!}
->help(trans('texts.enable_buy_now_buttons_help'))
->value(1) !!}
@if ($account->enable_buy_now_buttons)
{!! Former::select('product')

View File

@ -31,13 +31,15 @@
{!! Former::checkbox('pdf_email_attachment')
->text(trans('texts.enable'))
->value(1)
->help( ! Utils::isNinja() ? (env('PHANTOMJS_BIN_PATH') ? 'phantomjs_local' : trans('texts.phantomjs_help', [
'link_phantom' => link_to('https://phantomjscloud.com/', 'phantomjscloud.com', ['target' => '_blank']),
'link_docs' => link_to('https://www.invoiceninja.com/self-host/#phantomjs', 'PhantomJS', ['target' => '_blank'])
])) : false) !!}
{!! Former::checkbox('document_email_attachment')
->text(trans('texts.enable')) !!}
->text(trans('texts.enable'))
->value(1) !!}
&nbsp;
@ -93,7 +95,8 @@
{!! Former::checkbox('enable_email_markup')
->text(trans('texts.enable') .
'<a href="'.EMAIL_MARKUP_URL.'" target="_blank" title="'.trans('texts.learn_more').'">' . Icon::create('question-sign') . '</a> ')
->help(trans('texts.enable_email_markup_help')) !!}
->help(trans('texts.enable_email_markup_help'))
->value(1) !!}
@endif
</div>
</div>

View File

@ -253,9 +253,9 @@
<div role="tabpanel" class="tab-pane" id="invoice_options">
<div class="panel-body">
{!! Former::checkbox('hide_quantity')->text(trans('texts.hide_quantity_help')) !!}
{!! Former::checkbox('hide_paid_to_date')->text(trans('texts.hide_paid_to_date_help')) !!}
{!! Former::checkbox('invoice_embed_documents')->text(trans('texts.invoice_embed_documents_help')) !!}
{!! Former::checkbox('hide_quantity')->text(trans('texts.hide_quantity_help'))->value(1) !!}
{!! Former::checkbox('hide_paid_to_date')->text(trans('texts.hide_paid_to_date_help'))->value(1) !!}
{!! Former::checkbox('invoice_embed_documents')->text(trans('texts.invoice_embed_documents_help'))->value(1) !!}
</div>
</div>

View File

@ -97,7 +97,7 @@
{!! Former::text('quote_number_counter')
->label(trans('texts.counter'))
->addGroupClass('pad-checkbox')
->append(Former::checkbox('share_counter')->raw()
->append(Former::checkbox('share_counter')->raw()->value(1)
->onclick('setQuoteNumberEnabled()') . ' ' . trans('texts.share_invoice_counter'))
->help(trans('texts.quote_number_help') . ' ' .
trans('texts.next_quote_number', ['number' => $account->previewNextInvoiceNumber(ENTITY_QUOTE)])) !!}
@ -111,6 +111,7 @@
->label('client_number')
->onchange('onClientNumberEnabled()')
->text('enable')
->value(1)
->check($account->client_number_counter > 0) !!}
<div id="clientNumberDiv" style="display:none">
@ -237,11 +238,13 @@
->label(trans('texts.field_label'))
->addGroupClass('pad-checkbox')
->append(Former::checkbox('custom_invoice_taxes1')
->value(1)
->raw() . trans('texts.charge_taxes')) !!}
{!! Former::text('custom_invoice_label2')
->label(trans('texts.field_label'))
->addGroupClass('pad-checkbox')
->append(Former::checkbox('custom_invoice_taxes2')
->value(1)
->raw() . trans('texts.charge_taxes'))
->help(trans('texts.custom_invoice_charges_helps')) !!}
@ -258,7 +261,8 @@
<div class="panel-body form-padding-right">
{!! Former::checkbox('auto_convert_quote')
->text(trans('texts.enable'))
->blockHelp(trans('texts.auto_convert_quote_help')) !!}
->blockHelp(trans('texts.auto_convert_quote_help'))
->value(1) !!}
</div>
</div>

View File

@ -49,7 +49,7 @@
->fromQuery($dateFormats) !!}
{!! Former::select('datetime_format_id')->addOption('','')
->fromQuery($datetimeFormats) !!}
{!! Former::checkbox('military_time')->text(trans('texts.enable')) !!}
{!! Former::checkbox('military_time')->text(trans('texts.enable'))->value(1) !!}
<br/>&nbsp;<br/>

View File

@ -195,10 +195,12 @@
{!! Former::checkbox('live_preview')
->text(trans('texts.enable'))
->help('live_preview_help') !!}
->help('live_preview_help')
->value(1) !!}
{!! Former::checkbox('force_pdfjs')
->text(trans('texts.enable'))
->value(1)
->help(trans('texts.force_pdfjs_help', [
'chrome_link' => link_to(CHROME_PDF_HELP_URL, 'Chrome', ['target' => '_blank']),
'firefox_link' => link_to(FIREFOX_PDF_HELP_URL, 'Firefox', ['target' => '_blank']),

View File

@ -8,9 +8,9 @@
<h3 class="panel-title">{!! trans('texts.email_notifications') !!}</h3>
</div>
<div class="panel-body">
{!! Former::checkbox('notify_sent')->label('&nbsp;')->text(trans('texts.email_sent')) !!}
{!! Former::checkbox('notify_viewed')->label('&nbsp;')->text(trans('texts.email_viewed')) !!}
{!! Former::checkbox('notify_paid')->label('&nbsp;')->text(trans('texts.email_paid')) !!}
{!! Former::checkbox('notify_approved')->label('&nbsp;')->text(trans('texts.email_approved')) !!}
{!! Former::checkbox('notify_sent')->label('&nbsp;')->text(trans('texts.email_sent'))->value(1) !!}
{!! Former::checkbox('notify_viewed')->label('&nbsp;')->text(trans('texts.email_viewed'))->value(1) !!}
{!! Former::checkbox('notify_paid')->label('&nbsp;')->text(trans('texts.email_paid'))->value(1) !!}
{!! Former::checkbox('notify_approved')->label('&nbsp;')->text(trans('texts.email_approved'))->value(1) !!}
</div>
</div>

View File

@ -16,8 +16,8 @@
</div>
<div class="panel-body">
{!! Former::checkbox('fill_products')->text(trans('texts.fill_products_help')) !!}
{!! Former::checkbox('update_products')->text(trans('texts.update_products_help')) !!}
{!! Former::checkbox('fill_products')->text(trans('texts.fill_products_help'))->value(1) !!}
{!! Former::checkbox('update_products')->text(trans('texts.update_products_help'))->value(1) !!}
&nbsp;
{!! Former::actions( Button::success(trans('texts.save'))->submit()->appendIcon(Icon::create('floppy-disk')) ) !!}
{!! Former::close() !!}

View File

@ -22,23 +22,28 @@
{!! Former::checkbox('invoice_taxes')
->text(trans('texts.enable_invoice_tax'))
->label('&nbsp;') !!}
->label('&nbsp;')
->value(1) !!}
{!! Former::checkbox('invoice_item_taxes')
->text(trans('texts.enable_line_item_tax'))
->label('&nbsp;') !!}
->label('&nbsp;')
->value(1) !!}
{!! Former::checkbox('show_item_taxes')
->text(trans('texts.show_line_item_tax'))
->label('&nbsp;') !!}
->label('&nbsp;')
->value(1) !!}
{!! Former::checkbox('include_item_taxes_inline')
->text(trans('texts.include_item_taxes_inline'))
->label('&nbsp;') !!}
->label('&nbsp;')
->value(1) !!}
{!! Former::checkbox('enable_second_tax_rate')
->text(trans('texts.enable_second_tax_rate'))
->label('&nbsp;') !!}
->label('&nbsp;')
->value(1) !!}
&nbsp;

View File

@ -7,7 +7,8 @@
<div class="row" style="padding-bottom:20px">
<div class="col-md-6">
{!! Former::checkbox('enable_' . $field)
->text(trans('texts.enable'))->label('') !!}
->text(trans('texts.enable'))->label('')
->value(1) !!}
{!! Former::plaintext('schedule')
->value(

View File

@ -62,12 +62,13 @@
@else
{!! Former::checkbox('referral_code')
->help(trans('texts.referral_code_help'))
->text(trans('texts.enable') . ' <a href="'.REFERRAL_PROGRAM_URL.'" target="_blank" title="'.trans('texts.learn_more').'">' . Icon::create('question-sign') . '</a>') !!}
->text(trans('texts.enable') . ' <a href="'.REFERRAL_PROGRAM_URL.'" target="_blank" title="'.trans('texts.learn_more').'">' . Icon::create('question-sign') . '</a>')
->value(1) !!}
@endif
@endif
@if (false && Utils::isNinjaDev())
{!! Former::checkbox('dark_mode')->text(trans('texts.dark_mode_help')) !!}
{!! Former::checkbox('dark_mode')->text(trans('texts.dark_mode_help'))->value(1) !!}
@endif
</div>

View File

@ -82,14 +82,16 @@
{!! Former::checkbox('should_be_invoiced')
->text(trans('texts.should_be_invoiced'))
->data_bind('checked: should_be_invoiced() || client_id(), enable: !client_id()')
->label(' ') !!}
->label(' ')
->value(1) !!}
@endif
@if (!$expense || ($expense && ! $expense->isExchanged()))
{!! Former::checkbox('convert_currency')
->text(trans('texts.convert_currency'))
->data_bind('checked: convert_currency')
->label(' ') !!}
->label(' ')
->value(1) !!}
@endif
@ -123,7 +125,8 @@
{!! Former::checkbox('apply_taxes')
->text(trans('texts.apply_taxes'))
->data_bind('checked: apply_taxes')
->label(' ') !!}
->label(' ')
->value(1) !!}
@endif
<div style="display:none" data-bind="visible: apply_taxes">

View File

@ -627,7 +627,11 @@
<div class="row signup-form">
<div class="col-md-11 col-md-offset-1">
{!! Former::checkbox('terms_checkbox')->label(' ')->text(trans('texts.agree_to_terms', ['terms' => '<a href="'.URL::to('terms').'" target="_blank">'.trans('texts.terms_of_service').'</a>']))->raw() !!}
{!! Former::checkbox('terms_checkbox')
->label(' ')
->value(1)
->text(trans('texts.agree_to_terms', ['terms' => '<a href="'.URL::to('terms').'" target="_blank">'.trans('texts.terms_of_service').'</a>']))
->raw() !!}
<br/>
</div>
@if (Utils::isOAuthEnabled())

View File

@ -4,8 +4,8 @@
</div>
<div class="panel-body form-padding-right">
{!! Former::text('app[url]')->label(trans('texts.url'))->value(isset($_ENV['APP_URL']) ? $_ENV['APP_URL'] : Request::root()) !!}
{!! Former::checkbox('https')->text(trans('texts.require'))->check(env('REQUIRE_HTTPS')) !!}
{!! Former::checkbox('debug')->text(trans('texts.enable'))->check(config('app.debug')) !!}
{!! Former::checkbox('https')->text(trans('texts.require'))->check(env('REQUIRE_HTTPS'))->value(1) !!}
{!! Former::checkbox('debug')->text(trans('texts.enable'))->check(config('app.debug'))->value(1) !!}
</div>
</div>

View File

@ -67,7 +67,7 @@
{!! Former::text('transaction_reference') !!}
@if (!$payment)
{!! Former::checkbox('email_receipt')->label('&nbsp;')->text(trans('texts.email_receipt')) !!}
{!! Former::checkbox('email_receipt')->label('&nbsp;')->text(trans('texts.email_receipt'))->value(1) !!}
@endif
</div>

View File

@ -220,7 +220,8 @@
{!! Former::checkbox('authorize_ach')
->text(trans('texts.ach_authorization', ['company'=>$account->getDisplayName(), 'email' => $account->work_email]))
->label(' ') !!}
->label(' ')
->value(1) !!}
<div class="col-md-12">

View File

@ -13,7 +13,8 @@
{!! Former::checkbox('authorize_ach')
->text(trans('texts.ach_authorization', ['company'=>$account->getDisplayName(), 'email' => $account->work_email]))
->label(' ') !!}
->label(' ')
->value(1) !!}
{!! Former::checkbox('tos_agree')
->text(trans('texts.wepay_payment_tos_agree', [
@ -21,7 +22,8 @@
'privacy_policy' => '<a href="https://go.wepay.com/privacy-policy-us" target="_blank">'.trans('texts.privacy_policy').'</a>',
]))
->help(trans('texts.payment_processed_through_wepay'))
->label(' ') !!}
->label(' ')
->value(1) !!}
<input type="hidden" name="sourceToken" value="{{$sourceId}}">

View File

@ -1,8 +1,8 @@
<!DOCTYPE html>
<html lang="{{App::getLocale()}}">
<head>
<title>Invoice Ninja | Setup</title>
<meta charset="utf-8">
<title>Invoice Ninja | Setup</title>
<meta charset="utf-8">
<meta name="csrf-token" content="<?= csrf_token() ?>">
<script src="{{ asset('built.js') }}?no_cache={{ NINJA_VERSION }}" type="text/javascript"></script>
<link href="{{ asset('css/built.public.css') }}?no_cache={{ NINJA_VERSION }}" rel="stylesheet" type="text/css"/>
@ -37,7 +37,7 @@
<pre>sudo chown www-data:www-data /path/to/ninja/.env</pre>
</div>
@endif
If you need help you can either post to our <a href="https://www.invoiceninja.com/forums/forum/support/" target="_blank">support forum</a> with the design you\'re using
If you need help you can either post to our <a href="https://www.invoiceninja.com/forums/forum/support/" target="_blank">support forum</a> with the design you\'re using
or email us at <a href="mailto:contact@invoiceninja.com" target="_blank">contact@invoiceninja.com</a>.
<p>
<pre>-- Commands to create a MySQL database and user
@ -71,16 +71,16 @@ FLUSH PRIVILEGES;</pre>
{!! Former::text('first_name') !!}
{!! Former::text('last_name') !!}
{!! Former::text('email') !!}
{!! Former::password('password') !!}
{!! Former::password('password') !!}
</div>
</div>
{!! Former::checkbox('terms_checkbox')->label(' ')->text(trans('texts.agree_to_terms', ['terms' => '<a href="'.NINJA_APP_URL.'/terms" target="_blank">'.trans('texts.terms_of_service').'</a>'])) !!}
{!! Former::actions( Button::primary('Submit')->large()->submit() ) !!}
{!! Former::checkbox('terms_checkbox')->label(' ')->text(trans('texts.agree_to_terms', ['terms' => '<a href="'.NINJA_APP_URL.'/terms" target="_blank">'.trans('texts.terms_of_service').'</a>']))->value(1) !!}
{!! Former::actions( Button::primary('Submit')->large()->submit() ) !!}
{!! Former::close() !!}
</div>
</body>
</html>
</body>
</html>