Browse Source

Change partner_id options based on in_out selection

pull/33/head
Nafies Luthfi 7 years ago
parent
commit
b2cdda251d
  1. 3
      resources/lang/de/customer.php
  2. 1
      resources/lang/de/vendor.php
  3. 3
      resources/lang/en/customer.php
  4. 1
      resources/lang/en/vendor.php
  5. 3
      resources/lang/id/customer.php
  6. 1
      resources/lang/id/vendor.php
  7. 30
      resources/views/payments/edit.blade.php

3
resources/lang/de/customer.php

@ -4,12 +4,13 @@ return [
// Labels
'customer' => 'Kunde',
'list' => 'Kundenliste',
'detail' => 'Kundendetails',
'search' => 'Kundensuche',
'select' => 'Select Customer',
'not_found' => 'Kunde nicht gefunden.',
'empty' => 'Kunde ist leer.',
'back_to_show' => 'Zurück zu Kundendetails',
'back_to_index' => 'Zurück zur Kundennliste',
'detail' => 'Kundendetails',
'contact' => 'Kundenkontakt',
// Actions

1
resources/lang/de/vendor.php

@ -6,6 +6,7 @@ return [
'list' => 'Hersteller Liste',
'detail' => 'Vendor Detail',
'search' => 'Hersteller suchen',
'select' => 'Select Vendor',
'not_found' => 'Hersteller nicht gefunden.',
'empty' => 'Hersteller Liste ist leer.',
'back_to_show' => 'Zurück zu Herstellerdetails',

3
resources/lang/en/customer.php

@ -4,12 +4,13 @@ return [
// Labels
'customer' => 'Customer',
'list' => 'Customer List',
'detail' => 'Customer Detail',
'search' => 'Search Customer',
'select' => 'Select Customer',
'not_found' => 'Customer not found.',
'empty' => 'Customer is empty.',
'back_to_show' => 'Back to Customer Detail',
'back_to_index' => 'Back to Customer List',
'detail' => 'Customer Detail',
'contact' => 'Customer Contact',
// Actions

1
resources/lang/en/vendor.php

@ -6,6 +6,7 @@ return [
'list' => 'Vendor List',
'detail' => 'Vendor Detail',
'search' => 'Search Vendor',
'select' => 'Select Vendor',
'not_found' => 'Vendor not found.',
'empty' => 'Vendor list is empty.',
'back_to_show' => 'Back to Vendor Detail',

3
resources/lang/id/customer.php

@ -4,12 +4,13 @@ return [
// Labels
'customer' => 'Customer',
'list' => 'Daftar Customer',
'detail' => 'Detail Customer',
'search' => 'Cari Customer',
'select' => 'Pilih Customer',
'not_found' => 'Customer tidak ditemukan',
'empty' => 'Belum ada Customer',
'back_to_show' => 'Kembali ke detail Customer',
'back_to_index' => 'Kembali ke daftar Customer',
'detail' => 'Detail Customer',
'contact' => 'Kontak Customer',
// Actions

1
resources/lang/id/vendor.php

@ -6,6 +6,7 @@ return [
'list' => 'Daftar Vendor',
'detail' => 'Detail Vendor',
'search' => 'Cari Vendor',
'select' => 'Pilih Vendor',
'not_found' => 'Vendor tidak ditemukan',
'empty' => 'Belum ada Vendor',
'back_to_show' => 'Kembali ke detail Vendor',

30
resources/views/payments/edit.blade.php

@ -34,11 +34,9 @@
</div>
<div class="col-sm-6">
@if ($payment->partner_type == 'App\Entities\Users\User')
{!! FormField::select('partner_id', $partners, ['label'=> __('payment.customer')]) !!}
{{ Form::hidden('partner_type', 'users') }}
@else
{!! FormField::select('partner_id', $partners, ['label'=> __('payment.customer')]) !!}
@endif
{!! FormField::select('partner_id', $partners, ['label'=> __('payment.customer')]) !!}
</div>
</div>
{!! FormField::textarea('description', ['label'=> __('payment.description')]) !!}
@ -72,6 +70,32 @@
closeOnDateSelect: true,
scrollInput: false
});
$('#in_out_0').click(function() {
$.post("{{ route('api.vendors.index') }}", {},
function(data) {
var string = '<option value="">-- {{ __('vendor.select') }} --</option>';
string = string + `<optgroup label="Vendor">`;
$.each(data, function(index, value) {
string = string + `<option value="` + index + `">` + value + `</option>`;
});
string = string + `</optgroup>`;
$("#partner_id").html(string);
}
);
});
$('#in_out_1').click(function() {
$.post("{{ route('api.customers.index') }}", {},
function(data) {
var string = '<option value="">-- {{ __('customer.select') }} --</option>';
string = string + `<optgroup label="Customer">`;
$.each(data, function(index, value) {
string = string + `<option value="` + index + `">` + value + `</option>`;
});
string = string + `</optgroup>`;
$("#partner_id").html(string);
}
);
});
})();
</script>
@endsection
Loading…
Cancel
Save