diff --git a/app/assets/javascripts/templates/admin/panels/exchange_products_simple.html.haml b/app/assets/javascripts/templates/admin/panels/exchange_products_simple.html.haml new file mode 100644 index 0000000000..ee9be41c8c --- /dev/null +++ b/app/assets/javascripts/templates/admin/panels/exchange_products_simple.html.haml @@ -0,0 +1,12 @@ +.row.exchange-supplied-products + .sixteen.columns.alpha.omega + .exchange-select-all-variants + %label + %input{ type: 'checkbox', name: 'order_cycle_incoming_exchange_{{ $index }}_select_all_variants', + value: 1, + 'ng-model' => 'exchange.select_all_variants', + 'ng-change' => 'setExchangeVariants(exchange, suppliedVariants(exchange.enterprise_id), exchange.select_all_variants)', + 'id' => 'order_cycle_incoming_exchange_{{ $index }}_select_all_variants' } + {{ 'admin.select_all' | t }} + + %div{ 'ng-include' => "'admin/panels/exchange_products_supplied_list.html'" } diff --git a/app/assets/javascripts/templates/admin/panels/exchange_products_supplied_list.html.haml b/app/assets/javascripts/templates/admin/panels/exchange_products_supplied_list.html.haml new file mode 100644 index 0000000000..f5753df343 --- /dev/null +++ b/app/assets/javascripts/templates/admin/panels/exchange_products_supplied_list.html.haml @@ -0,0 +1,16 @@ +.exchange-products{ 'ng-hide' => 'productsLoading()' } + .exchange-product{'ng-repeat' => 'product in enterprises[exchange.enterprise_id].supplied_products'} + .exchange-product-details + %label + %img{'ng-src' => '{{ product.image_url }}'} + {{ product.name }} + + .exchange-product-variant{'ng-repeat' => 'variant in product.variants'} + %label + %input{ type: 'checkbox', name: 'order_cycle_incoming_exchange_{{ $parent.$parent.$index }}_variants_{{ variant.id }}', + value: 1, + 'ng-model' => 'exchange.variants[variant.id]', + 'ofn-sync-distributions' => '{{ variant.id }}', + 'id' => 'order_cycle_incoming_exchange_{{ $parent.$parent.$index }}_variants_{{ variant.id }}', + 'ng-disabled' => '!order_cycle.editable_variants_for_incoming_exchanges.hasOwnProperty(exchange.enterprise_id) || order_cycle.editable_variants_for_incoming_exchanges[exchange.enterprise_id].indexOf(variant.id) < 0' } + {{ variant.label }} diff --git a/app/assets/javascripts/templates/admin/panels/exchange_supplied_products.html.haml b/app/assets/javascripts/templates/admin/panels/exchange_supplied_products.html.haml index 91747d30ce..ffc5277168 100644 --- a/app/assets/javascripts/templates/admin/panels/exchange_supplied_products.html.haml +++ b/app/assets/javascripts/templates/admin/panels/exchange_supplied_products.html.haml @@ -11,21 +11,6 @@ 'id' => 'order_cycle_incoming_exchange_{{ $index }}_select_all_variants' } {{ 'js.admin.panels.exchange_products.select_all_products' | t:{ total_number_of_products: enterprises[exchange.enterprise_id].num_of_products } }} - .exchange-products{ 'ng-hide' => 'productsLoading()' } - .exchange-product{'ng-repeat' => 'product in enterprises[exchange.enterprise_id].supplied_products'} - .exchange-product-details - %label - %img{'ng-src' => '{{ product.image_url }}'} - {{ product.name }} - - .exchange-product-variant{'ng-repeat' => 'variant in product.variants'} - %label - %input{ type: 'checkbox', name: 'order_cycle_incoming_exchange_{{ $parent.$parent.$index }}_variants_{{ variant.id }}', - value: 1, - 'ng-model' => 'exchange.variants[variant.id]', - 'ofn-sync-distributions' => '{{ variant.id }}', - 'id' => 'order_cycle_incoming_exchange_{{ $parent.$parent.$index }}_variants_{{ variant.id }}', - 'ng-disabled' => '!order_cycle.editable_variants_for_incoming_exchanges.hasOwnProperty(exchange.enterprise_id) || order_cycle.editable_variants_for_incoming_exchanges[exchange.enterprise_id].indexOf(variant.id) < 0' } - {{ variant.label }} + %div{ 'ng-include' => "'admin/panels/exchange_products_supplied_list.html'" } %div{ 'ng-include' => "'admin/panels/exchange_products_panel_footer.html'" } diff --git a/app/views/admin/order_cycles/_simple_form.html.haml b/app/views/admin/order_cycles/_simple_form.html.haml index 843f27ba78..3f6372175d 100644 --- a/app/views/admin/order_cycles/_simple_form.html.haml +++ b/app/views/admin/order_cycles/_simple_form.html.haml @@ -17,7 +17,7 @@ %table.exchanges %tbody{ng: {repeat: "exchange in order_cycle.incoming_exchanges"}} %tr.products - %td{ ng: { include: "'admin/panels/exchange_supplied_products.html'" } } + %td{ ng: { include: "'admin/panels/exchange_products_simple.html'" } } %br/ = label_tag t('.fees')