mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-06 22:36:07 +00:00
100 lines
6.2 KiB
Plaintext
100 lines
6.2 KiB
Plaintext
- content_for :page_title do
|
|
%h1.page-title
|
|
=t :customers
|
|
|
|
- content_for :app_wrapper_attrs do
|
|
= "ng-app='admin.customers'"
|
|
|
|
- content_for :page_actions do
|
|
%li
|
|
%a.button.icon-plus#new-customer{ href: "#", "new-customer-dialog" => true }
|
|
= t('admin.customers.index.new_customer')
|
|
|
|
= admin_inject_column_preferences module: 'admin.customers'
|
|
= admin_inject_shops
|
|
= admin_inject_available_countries
|
|
|
|
%div{ ng: { controller: 'customersCtrl' } }
|
|
.row.filters
|
|
.sixteen.columns.alpha.omega
|
|
.filter_select.five.columns.alpha
|
|
%label{ :for => 'quick_search', ng: {class: '{disabled: !shop_id}'} }=t('admin.quick_search')
|
|
%br
|
|
%input.fullwidth{ :type => "text", :id => 'quick_search', ng: { model: 'quickSearch', disabled: '!shop_id' }, :placeholder => "Search by email/code..." }
|
|
.filter_select.four.columns
|
|
%label{ :for => 'hub_id', ng: { bind: "shop_id ? '#{t('admin.shop')}' : '#{t('admin.variant_overrides.index.select_a_shop')}'" } }
|
|
%br
|
|
%input.ofn-select2.fullwidth#shop_id{ 'ng-model' => 'shop_id', name: 'shop_id', data: 'shops', on: { selecting: 'confirmRefresh' } }
|
|
.seven.columns.omega
|
|
|
|
%hr.divider{ ng: { show: "!RequestMonitor.loading && filteredCustomers.length > 0" } }
|
|
|
|
.row.controls{ ng: { show: "!RequestMonitor.loading && filteredCustomers.length > 0" } }
|
|
.thirteen.columns.alpha
|
|
%columns-dropdown{ action: "#{controller_name}_#{action_name}" }
|
|
|
|
.row{ 'ng-if' => 'shop_id && RequestMonitor.loading' }
|
|
.sixteen.columns.alpha#loading
|
|
%img.spinner{ src: "/assets/spinning-circles.svg" }
|
|
%h1
|
|
=t :loading_customers
|
|
|
|
.row{ :class => "sixteen columns alpha", 'ng-show' => '!RequestMonitor.loading && filteredCustomers.length == 0'}
|
|
%h1#no_results
|
|
=t :no_customers_found
|
|
|
|
.row.margin-bottom-50{ ng: { show: "!RequestMonitor.loading && filteredCustomers.length > 0" } }
|
|
%form{ name: "customers_form" }
|
|
%save-bar{ dirty: "customers_form.$dirty", persist: "false" }
|
|
%input.red{ type: "button", value: "Save Changes", ng: { click: "submitAll(customers_form)", disabled: "!customers_form.$dirty" } }
|
|
|
|
%table.index#customers
|
|
%col.email{ width: "20%", 'ng-show' => 'columns.email.visible' }
|
|
%col.name{ width: "20%", 'ng-show' => 'columns.name.visible' }
|
|
%col.code{ width: "10%", 'ng-show' => 'columns.code.visible' }
|
|
%col.tags{ width: "20%", 'ng-show' => 'columns.tags.visible' }
|
|
%col.bill_address{ width: "10%", 'ng-show' => 'columns.bill_address.visible' }
|
|
%col.ship_address{ width: "10%", 'ng-show' => 'columns.ship_address.visible' }
|
|
%col.actions{ width: "10%"}
|
|
%thead
|
|
%tr{ ng: { controller: "ColumnsCtrl" } }
|
|
-# %th.bulk
|
|
-# %input{ :type => "checkbox", :name => 'toggle_bulk', 'ng-click' => 'toggleAllCheckboxes()', 'ng-checked' => "allBoxesChecked()" }
|
|
%th.email{ 'ng-show' => 'columns.email.visible' }
|
|
%a{ :href => '', 'ng-click' => "predicate = 'customer.email'; reverse = !reverse" }=t('admin.email')
|
|
%th.name{ 'ng-show' => 'columns.name.visible' }
|
|
%a{ :href => '', 'ng-click' => "predicate = 'customer.name'; reverse = !reverse" }=t('admin.name')
|
|
%th.code{ 'ng-show' => 'columns.code.visible' }
|
|
%a{ :href => '', 'ng-click' => "predicate = 'customer.code'; reverse = !reverse" }=t('admin.customers.index.code')
|
|
%th.tags{ 'ng-show' => 'columns.tags.visible' }=t('admin.tags')
|
|
%th.bill_address{ 'ng-show' => 'columns.bill_address.visible' }=t('admin.customers.index.bill_address')
|
|
%th.ship_address{ 'ng-show' => 'columns.ship_address.visible' }=t('admin.customers.index.ship_address')
|
|
%th.actions
|
|
Ask?
|
|
%input{ :type => 'checkbox', 'ng-model' => "confirmDelete" }
|
|
%tr.customer{ 'ng-repeat' => "customer in filteredCustomers = ( customers | filter:quickSearch | orderBy:predicate:reverse ) | limitTo:customerLimit track by customer.id", 'ng-class-even' => "'even'", 'ng-class-odd' => "'odd'", :id => "c_{{customer.id}}" }
|
|
-# %td.bulk
|
|
-# %input{ :type => "checkbox", :name => 'bulk', 'ng-model' => 'customer.checked' }
|
|
%td.email{ 'ng-show' => 'columns.email.visible', "ng-bind" => '::customer.email' }
|
|
%td.name{ 'ng-show' => 'columns.name.visible'}
|
|
%input{ type: 'text', name: 'name', ng: { model: 'customer.name' }, 'obj-for-update' => 'customer', 'attr-for-update' => 'name'}
|
|
%td.code{ 'ng-show' => 'columns.code.visible' }
|
|
%input{ type: 'text', name: 'code', ng: {model: 'customer.code', change: 'checkForDuplicateCodes()'}, "obj-for-update" => "customer", "attr-for-update" => "code" }
|
|
%i.icon-warning-sign{ ng: {if: 'duplicate'} }
|
|
= t('.duplicate_code')
|
|
%td.tags{ 'ng-show' => 'columns.tags.visible' }
|
|
.tag_watcher{ 'obj-for-update' => "customer", "attr-for-update" => "tag_list"}
|
|
%tags_with_translation{ object: 'customer', 'find-tags' => 'findTags(query)' }
|
|
%td.bill_address{ 'ng-show' => 'columns.bill_address.visible' }
|
|
%a{ id: 'bill-address-link', href: '#', "ng-bind" => "customer.bill_address ? customer.bill_address.address1 : '#{t('admin.customers.index.edit')}' | limitTo: 15", 'edit-address-dialog' => true }
|
|
%td.ship_address{ 'ng-show' => 'columns.ship_address.visible' }
|
|
%a{ id: 'ship-address-link', href: '#', "ng-bind" => "customer.ship_address ? customer.ship_address.address1 : '#{t('admin.customers.index.edit')}' | limitTo: 15", 'edit-address-dialog' => true }
|
|
%td.actions
|
|
%a{ 'ng-click' => "deleteCustomer(customer)", :class => "delete-customer icon-trash no-text" }
|
|
|
|
-# %show-more.text-center{ data: "filteredCustomers", limit: "customerLimit", increment: "20" }
|
|
%div.text-center{ ng: { show: "filteredCustomers.length > customerLimit" } }
|
|
%input{ type: 'button', value: 'Show More', ng: { click: 'customerLimit = customerLimit + 20' } }
|
|
or
|
|
%input{ type: 'button', value: "Show All ({{ filteredCustomers.length - customerLimit }} More)", ng: { click: 'customerLimit = filteredCustomers.length' } }
|