rails_crm 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +20 -0
  3. data/README.md +33 -0
  4. data/Rakefile +32 -0
  5. data/app/controllers/crm/admin/base_controller.rb +20 -0
  6. data/app/controllers/crm/admin/maintain_logs_controller.rb +65 -0
  7. data/app/controllers/crm/admin/maintain_source_templates_controller.rb +52 -0
  8. data/app/controllers/crm/admin/maintain_sources_controller.rb +62 -0
  9. data/app/controllers/crm/admin/maintain_tag_templates_controller.rb +56 -0
  10. data/app/controllers/crm/admin/maintain_tags_controller.rb +66 -0
  11. data/app/controllers/crm/admin/maintains_controller.rb +289 -0
  12. data/app/controllers/crm/my/base_controller.rb +4 -0
  13. data/app/models/crm/application_record.rb +5 -0
  14. data/app/models/crm/maintain.rb +6 -0
  15. data/app/models/crm/maintain_log.rb +5 -0
  16. data/app/models/crm/maintain_source.rb +5 -0
  17. data/app/models/crm/maintain_source_template.rb +5 -0
  18. data/app/models/crm/maintain_tag.rb +5 -0
  19. data/app/models/crm/maintain_tag_template.rb +5 -0
  20. data/app/models/crm/model/agency.rb +18 -0
  21. data/app/models/crm/model/maintain.rb +91 -0
  22. data/app/models/crm/model/maintain_log.rb +18 -0
  23. data/app/models/crm/model/maintain_source.rb +19 -0
  24. data/app/models/crm/model/maintain_source_template.rb +12 -0
  25. data/app/models/crm/model/maintain_tag.rb +44 -0
  26. data/app/models/crm/model/maintain_tag_template.rb +17 -0
  27. data/app/models/crm/model/member.rb +11 -0
  28. data/app/models/crm/model/order.rb +10 -0
  29. data/app/models/crm/model/organ.rb +15 -0
  30. data/app/models/crm.rb +11 -0
  31. data/app/views/admin/_crm_nav.html.erb +13 -0
  32. data/app/views/crm/admin/maintain_logs/_breadcrumb.html.erb +6 -0
  33. data/app/views/crm/admin/maintain_logs/_filter_form.html.erb +8 -0
  34. data/app/views/crm/admin/maintain_logs/_form.html.erb +6 -0
  35. data/app/views/crm/admin/maintain_logs/_index_tbody.html.erb +8 -0
  36. data/app/views/crm/admin/maintain_logs/_index_thead.html.erb +14 -0
  37. data/app/views/crm/admin/maintain_logs/_maintain_log.json.jbuilder +11 -0
  38. data/app/views/crm/admin/maintain_logs/_show.json.jbuilder +1 -0
  39. data/app/views/crm/admin/maintain_logs/_show_table.html.erb +16 -0
  40. data/app/views/crm/admin/maintain_logs/index.json.jbuilder +2 -0
  41. data/app/views/crm/admin/maintain_source_templates/_edit_form.html.erb +4 -0
  42. data/app/views/crm/admin/maintain_source_templates/_filter_form.html.erb +8 -0
  43. data/app/views/crm/admin/maintain_source_templates/_form.html.erb +2 -0
  44. data/app/views/crm/admin/maintain_source_templates/_index_tbody.html.erb +14 -0
  45. data/app/views/crm/admin/maintain_source_templates/_index_thead.html.erb +2 -0
  46. data/app/views/crm/admin/maintain_source_templates/_maintain_source.json.jbuilder +7 -0
  47. data/app/views/crm/admin/maintain_source_templates/_new_form.html.erb +4 -0
  48. data/app/views/crm/admin/maintain_source_templates/_show.json.jbuilder +1 -0
  49. data/app/views/crm/admin/maintain_source_templates/_show_table.html.erb +8 -0
  50. data/app/views/crm/admin/maintain_source_templates/index.json.jbuilder +1 -0
  51. data/app/views/crm/admin/maintain_sources/_breadcrumb.html.erb +6 -0
  52. data/app/views/crm/admin/maintain_sources/_edit_form.html.erb +4 -0
  53. data/app/views/crm/admin/maintain_sources/_filter_form.html.erb +9 -0
  54. data/app/views/crm/admin/maintain_sources/_form.html.erb +2 -0
  55. data/app/views/crm/admin/maintain_sources/_index_tbody.html.erb +12 -0
  56. data/app/views/crm/admin/maintain_sources/_index_thead.html.erb +3 -0
  57. data/app/views/crm/admin/maintain_sources/_maintain_source.json.jbuilder +6 -0
  58. data/app/views/crm/admin/maintain_sources/_new_form.html.erb +4 -0
  59. data/app/views/crm/admin/maintain_sources/_show.json.jbuilder +1 -0
  60. data/app/views/crm/admin/maintain_sources/_show_table.html.erb +8 -0
  61. data/app/views/crm/admin/maintain_sources/index.json.jbuilder +1 -0
  62. data/app/views/crm/admin/maintain_sources/templates.html.erb +18 -0
  63. data/app/views/crm/admin/maintain_tag_templates/_edit_form.html.erb +4 -0
  64. data/app/views/crm/admin/maintain_tag_templates/_filter_form.html.erb +8 -0
  65. data/app/views/crm/admin/maintain_tag_templates/_form.html.erb +7 -0
  66. data/app/views/crm/admin/maintain_tag_templates/_index_tbody.html.erb +8 -0
  67. data/app/views/crm/admin/maintain_tag_templates/_index_thead.html.erb +7 -0
  68. data/app/views/crm/admin/maintain_tag_templates/_maintain_tag_template.json.jbuilder +11 -0
  69. data/app/views/crm/admin/maintain_tag_templates/_new_form.html.erb +4 -0
  70. data/app/views/crm/admin/maintain_tag_templates/_show.json.jbuilder +1 -0
  71. data/app/views/crm/admin/maintain_tag_templates/_show_table.html.erb +20 -0
  72. data/app/views/crm/admin/maintain_tag_templates/index.json.jbuilder +1 -0
  73. data/app/views/crm/admin/maintain_tags/_breadcrumb.html.erb +6 -0
  74. data/app/views/crm/admin/maintain_tags/_edit_form.html.erb +4 -0
  75. data/app/views/crm/admin/maintain_tags/_filter_form.html.erb +9 -0
  76. data/app/views/crm/admin/maintain_tags/_form.html.erb +5 -0
  77. data/app/views/crm/admin/maintain_tags/_index_tbody.html.erb +7 -0
  78. data/app/views/crm/admin/maintain_tags/_index_thead.html.erb +6 -0
  79. data/app/views/crm/admin/maintain_tags/_maintain_tag.json.jbuilder +9 -0
  80. data/app/views/crm/admin/maintain_tags/_new_form.html.erb +4 -0
  81. data/app/views/crm/admin/maintain_tags/_show.json.jbuilder +1 -0
  82. data/app/views/crm/admin/maintain_tags/_show_table.html.erb +24 -0
  83. data/app/views/crm/admin/maintain_tags/index.json.jbuilder +1 -0
  84. data/app/views/crm/admin/maintain_tags/templates.html.erb +22 -0
  85. data/app/views/crm/admin/maintains/_button.html.erb +3 -0
  86. data/app/views/crm/admin/maintains/_create_detect.html.erb +23 -0
  87. data/app/views/crm/admin/maintains/_edit_assign.html.erb +21 -0
  88. data/app/views/crm/admin/maintains/_edit_form.html.erb +4 -0
  89. data/app/views/crm/admin/maintains/_edit_order.html.erb +5 -0
  90. data/app/views/crm/admin/maintains/_edit_transfer.html.erb +19 -0
  91. data/app/views/crm/admin/maintains/_filter_form.html.erb +12 -0
  92. data/app/views/crm/admin/maintains/_filter_table.html.erb +54 -0
  93. data/app/views/crm/admin/maintains/_form.html.erb +37 -0
  94. data/app/views/crm/admin/maintains/_index_thead.html.erb +40 -0
  95. data/app/views/crm/admin/maintains/_index_tr.html.erb +36 -0
  96. data/app/views/crm/admin/maintains/_maintain.json.jbuilder +24 -0
  97. data/app/views/crm/admin/maintains/_new_batch_assign.html.erb +13 -0
  98. data/app/views/crm/admin/maintains/_new_detect.html.erb +15 -0
  99. data/app/views/crm/admin/maintains/_new_form.html.erb +4 -0
  100. data/app/views/crm/admin/maintains/_show.json.jbuilder +1 -0
  101. data/app/views/crm/admin/maintains/_show_table.html.erb +54 -0
  102. data/app/views/crm/admin/maintains/create_detect.js.erb +3 -0
  103. data/app/views/crm/admin/maintains/edit_assign.js +8 -0
  104. data/app/views/crm/admin/maintains/edit_assign.js.erb +3 -0
  105. data/app/views/crm/admin/maintains/edit_order.js.erb +12 -0
  106. data/app/views/crm/admin/maintains/edit_transfer.js +8 -0
  107. data/app/views/crm/admin/maintains/edit_transfer.js.erb +3 -0
  108. data/app/views/crm/admin/maintains/index.html.erb +26 -0
  109. data/app/views/crm/admin/maintains/index.json.jbuilder +2 -0
  110. data/app/views/crm/admin/maintains/new.json.jbuilder +5 -0
  111. data/app/views/crm/admin/maintains/new_batch_assign.js.erb +3 -0
  112. data/app/views/crm/admin/maintains/new_detect.js.erb +1 -0
  113. data/app/views/crm/admin/maintains/orders.html.erb +54 -0
  114. data/app/views/crm/admin/maintains/public.html.erb +83 -0
  115. data/app/views/crm/admin/maintains/public.json.jbuilder +2 -0
  116. data/config/locales/zh.attributes.yml +33 -0
  117. data/config/locales/zh.controller.yml +35 -0
  118. data/config/locales/zh.enum.yml +10 -0
  119. data/config/routes.rb +41 -0
  120. data/lib/rails_crm/config.rb +9 -0
  121. data/lib/rails_crm/engine.rb +16 -0
  122. data/lib/rails_crm.rb +2 -0
  123. metadata +178 -0
@@ -0,0 +1,4 @@
1
+ <%= form_with model: @maintain, url: { action: 'update' } do |f| %>
2
+ <% render partial: 'form', locals: { f: f } %>
3
+ <%= f.submit %>
4
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <%= form_with url: { action: 'order' }, method: :patch do |f| %>
2
+ <%= f.collection_select :card_template_id, @card_templates, :id, :name, label: '选择卡', include_blank: true %>
3
+ <div id="_advance_id_wrap"></div>
4
+ <%= f.submit %>
5
+ <% end %>
@@ -0,0 +1,19 @@
1
+ <div class="ui modal" id="modal">
2
+ <i class="fas fa-times close"></i>
3
+ <div class="ui header">
4
+ <%= t('.edit') %>
5
+ </div>
6
+
7
+ <div class="content">
8
+ <%= form_with scope: :maintain, url: transfer_admin_maintain_path(@maintain), method: :patch do |f| %>
9
+ <div class="inline fields">
10
+ <%= f.collection_select :pipeline_id, @pipelines, :id, :name, include_blank: true, can: { wrap_all: false } %>
11
+ <%= link_to new_admin_pipeline_path, aria: { label: '来源设置' }, target: '_blank' do %>
12
+ <i class="fas fa-cog"></i>
13
+ <% end %>
14
+ </div>
15
+ <%= f.collection_select :member_id, @members, :id, :name, can: { wrap_input_id: true } %>
16
+ <%= f.submit %>
17
+ <% end %>
18
+ </div>
19
+ </div>
@@ -0,0 +1,12 @@
1
+ <%= form_with theme: 'search', model: Maintain.new do |f| %>
2
+ <div class="field-body">
3
+ <%= f.text_field :'client.real_name' %>
4
+ <%= f.text_field :'tutelar.identity' %>
5
+ <%= f.text_field :'age-gte' %>
6
+ <%= f.text_field :'age-lte' %>
7
+ <div class="field is-narrow">
8
+ <%= f.submit %>
9
+ <%= link_to t('.clear'), filter_params(except: [:'client.real_name', :'tutelar.identity', 'age-gte', 'age-lte']), class: 'button is-light' %>
10
+ </div>
11
+ </div>
12
+ <% end %>
@@ -0,0 +1,54 @@
1
+ <table class="as-search">
2
+ <tr>
3
+ <th><%= Maintain.human_attribute_name(:state) %></th>
4
+ <td>
5
+ <%= link_to t('.all'), filter_params(except: [:state]), class: active_params(state: '', active: 'button is-info', item: 'button is-light') %>
6
+ <% Maintain.options_i18n(:state).each do |text, state| %>
7
+ <%= link_to text, filter_params(state: state), class: active_params(state: state, active: 'button is-info', item: 'button is-light') %>
8
+ <% end %>
9
+ </td>
10
+ </tr>
11
+ <tr>
12
+ <th>只看自己</th>
13
+ <td>
14
+ <%= link_to t('.all'), filter_params(except: [:member_id]), class: active_params(member_id: nil, active: 'button is-info', item: 'button is-light') %>
15
+ <%= link_to '只看自己', filter_params(member_id: current_member&.id), class: active_params(member_id: current_member&.id, active: 'button is-info', item: 'button is-light') %>
16
+ </td>
17
+ </tr>
18
+ <tr>
19
+ <th><%= link_to Maintain.human_attribute_name(:maintain_source_id), admin_maintain_sources_path, text: true %></th>
20
+ <td>
21
+ <%= link_to t('.all'), filter_params(except: [:maintain_source_id]), class: active_params(maintain_source_id: '', active: 'button is-info', item: 'button is-light') %>
22
+ <% @maintain_sources.each do |maintain_source| %>
23
+ <%= link_to maintain_source.name, filter_params(maintain_source_id: maintain_source.id), class: active_params(maintain_source_id: maintain_source.id, active: 'button is-info', item: 'button is-light') %>
24
+ <% end %>
25
+ <%= link_to new_admin_maintain_source_path, aria: { label: t('.new') }, class: 'button is-small is-rounded is-light' do %>
26
+ <i class="fas fa-plus"></i>
27
+ <% end %>
28
+ </td>
29
+ </tr>
30
+ <tr>
31
+ <th><%= link_to MaintainLog.human_attribute_name(:maintain_tag_id), admin_maintain_tags_path, text: true %></th>
32
+ <td>
33
+ <%= link_to t('.all'), filter_params(except: [:'maintain_logs.maintain_tag_id']), class: active_params('maintain_logs.maintain_tag_id': '', active: 'button is-info', item: 'button is-light') %>
34
+ <% @maintain_tags.each do |maintain_tag| %>
35
+ <%= link_to maintain_tag.name, filter_params('maintain_logs.maintain_tag_id': maintain_tag.id), class: active_params('maintain_logs.maintain_tag_id': maintain_tag.id, active: 'button is-info', item: 'button is-light') %>
36
+ <% end %>
37
+ <%= link_to new_admin_maintain_tag_path, aria: { label: t('.new') }, class: 'button is-small is-rounded is-light' do %>
38
+ <i class="fas fa-plus"></i>
39
+ <% end %>
40
+ </td>
41
+ </tr>
42
+ <tr>
43
+ <th><%= link_to Maintain.human_attribute_name(:pipeline_id), admin_task_templates_path(tasking_type: 'Maintain'), text: true %></th>
44
+ <td>
45
+ <%= link_to t('.all'), filter_params(except: [:pipeline_id]), class: active_params(pipeline_id: '', active: 'button is-info', item: 'button is-light') %>
46
+ <% @pipelines.each do |pipeline| %>
47
+ <%= link_to pipeline.name, filter_params(pipeline_id: pipeline.id), class: active_params(pipeline_id: pipeline.id, active: 'button is-info', item: 'button is-light') %>
48
+ <% end %>
49
+ <%= link_to new_admin_task_template_path(tasking_type: 'Maintain'), aria: { label: t('.new') }, class: 'button is-small is-rounded is-light' do %>
50
+ <i class="fas fa-plus"></i>
51
+ <% end %>
52
+ </td>
53
+ </tr>
54
+ </table>
@@ -0,0 +1,37 @@
1
+ <%= render 'shared/error_messages', target: @maintain %>
2
+ <h4 class="ui dividing center aligned header">儿童信息</h4>
3
+ <%= f.fields :client do |ef| %>
4
+ <%= ef.text_field :real_name %>
5
+ <%= ef.text_field :nick_name %>
6
+ <%= ef.select :birthday_type, options_for_select(Profile.options_i18n(:birthday_type)) %>
7
+ <%= ef.date_field :birthday %>
8
+ <%= ef.select :gender, options_for_select(Profile.options_i18n(:gender)) %>
9
+ <%= ef.file_field :avatar %>
10
+ <% end %>
11
+ <h4 class="ui dividing center aligned header">关系</h4>
12
+ <%= f.fields :agency do |ef| %>
13
+ <%= ef.select :relation, options_for_select(Agency.options_i18n(:relation)) %>
14
+ <% end %>
15
+ <h4 class="ui dividing center aligned header">家长信息</h4>
16
+ <%= f.fields :agent do |ef| %>
17
+ <%= ef.text_field :real_name %>
18
+ <%= ef.text_field :identity, required: true %>
19
+ <%= ef.select :gender, options_for_select(Profile.options_i18n(:gender)) %>
20
+ <%= render partial: 'taxon/nodes/outer_select', locals: { f: ef, outer: 'area' } %>
21
+ <%= ef.text_area :address, rows: 3 %>
22
+ <% end %>
23
+ <h4 class="ui dividing center aligned header">线索信息</h4>
24
+ <%= f.hidden_field :member_id %>
25
+ <div class="inline fields">
26
+ <%= f.collection_select :maintain_source_id, @maintain_sources, :id, :name, wrap: { all: false } %>
27
+ <%= link_to admin_maintain_sources_path, aria: { label: '来源设置' }, target: '_blank' do %>
28
+ <i class="fas fa-cog"></i>
29
+ <% end %>
30
+ </div>
31
+ <div class="inline fields">
32
+ <%= f.collection_select :pipeline_id, @pipelines, :id, :name, include_blank: true, wrap: { all: false } %>
33
+ <%= link_to admin_pipelines_path, aria: { label: '流水线' }, target: '_blank' do %>
34
+ <i class="fas fa-cog"></i>
35
+ <% end %>
36
+ </div>
37
+ <%= f.text_field :note %>
@@ -0,0 +1,40 @@
1
+ <th></th>
2
+ <th>
3
+ <p><%= Maintain.human_attribute_name('client.real_name') %></p>
4
+ <p class="has-text-grey"><%= Maintain.human_attribute_name('client.nick_name') %></p>
5
+ </th>
6
+ <th>
7
+ <p><%= Profile.human_attribute_name(:age) %></p>
8
+ <p><%= Profile.human_attribute_name(:gender) %></p>
9
+ </th>
10
+ <th>
11
+ <p><%= Maintain.human_attribute_name('agent.real_name') %></p>
12
+ <p class="has-text-success"><%= Maintain.human_attribute_name('agent.identity') %></p>
13
+ </th>
14
+ <th><%= Agency.human_attribute_name(:relation) %></th>
15
+ <th>
16
+ <div>
17
+ <%= Maintain.human_attribute_name(:maintain_source_id) %>
18
+ <%= link_to admin_maintain_sources_path, aria: { label: '来源设置' }, target: '_blank' do %>
19
+ <i class="fas fa-cog"></i>
20
+ <% end %>
21
+ </div>
22
+ <div>
23
+ <%= Maintain.human_attribute_name(:pipeline_id) %>
24
+ <%= link_to admin_task_templates_path(tasking_type: 'Maintain'), aria: { label: '流水线' }, target: '_blank' do %>
25
+ <i class="fas fa-cog"></i>
26
+ <% end %>
27
+ </div>
28
+ </th>
29
+ <th><%= Profile.human_attribute_name(:note) %></th>
30
+ <th>
31
+ <%= MaintainLog.human_attribute_name(:maintain_tag_id) %>
32
+ <%= link_to admin_maintain_tags_path, aria: { label: '标签设置' }, target: '_blank' do %>
33
+ <i class="fas fa-cog"></i>
34
+ <% end %>
35
+ </th>
36
+ <th>
37
+ <p class="has-text-grey"><%= Maintain.human_attribute_name(:member_id) %></p>
38
+ <p><%= Maintain.human_attribute_name(:state) %></p>
39
+ </th>
40
+ <th></th>
@@ -0,0 +1,36 @@
1
+ <tr title="<%= model.created_at %>">
2
+ <td>
3
+ <%= check_box_tag 'xx', model.id, false, data: { action: 'check#toggle' } %>
4
+ </td>
5
+ <td>
6
+ <p><%= model.client.name %></p>
7
+ </td>
8
+ <td>
9
+ <span><%= model.client.age %></span>
10
+ <span class="ui icon label">
11
+ <i class="fas <%= model.client.male? ? 'fa-male' : 'fa-female' %>"></i>
12
+ <%= model.client.gender_i18n %>
13
+ </span>
14
+ </td>
15
+ <td>
16
+ <p><%= model.agent.name %></p>
17
+ <p class="ui green text"><%= model.agent.identity %></p>
18
+ </td>
19
+ <td><%= model.agency.relation_i18n %></td>
20
+ <td>
21
+ <p><%= model.maintain_source&.name %></p>
22
+ <p>
23
+ <span><%= model.pipeline&.name %></span>
24
+ <% if model.pipeline_member %>
25
+ <span style="color: <%= model.pipeline_member.color %>">(<%= model.pipeline_member.name %>)</span>
26
+ <% end %>
27
+ </p>
28
+ </td>
29
+ <td><%= model.note %></td>
30
+ <td>
31
+ <% model.tags.each do |tag| %>
32
+ <span class="ui label"><%= tag %></span>
33
+ <% end %>
34
+ </td>
35
+ <%= yield %>
36
+ </tr>
@@ -0,0 +1,24 @@
1
+ json.extract!(
2
+ maintain,
3
+ :id,
4
+ :note,
5
+ :state,
6
+ :state_i18n,
7
+ :created_at
8
+ )
9
+ json.client maintain.client, :id, :real_name, :nick_name, :birthday_type, :birthday, :age_str, :gender#, :avatar_url
10
+ json.tutelar maintain.tutelar, :id, :real_name, :identity, :mobile, :address, :wechat
11
+ json.tutelage maintain.tutelage, :id, :relation
12
+ if maintain.maintain_source
13
+ json.maintain_source maintain.maintain_source, :id, :name
14
+ end
15
+ json.maintain_tags maintain.maintain_tags do |tag|
16
+ json.extract! tag, :id, :name, :color
17
+ end
18
+ json.plans maintain.plans do |plan|
19
+ json.extract! plan, :id, :begin_on, :end_on
20
+ end
21
+ json.booker_times maintain.booker_times do |booker_time|
22
+ json.extract! booker_time, :booking_on, :start_at, :finish_at
23
+ json.booked booker_time.booked, :id, :title
24
+ end
@@ -0,0 +1,13 @@
1
+ <div class="ui modal" id="modal">
2
+ <i class="fas fa-times close"></i>
3
+ <div class="ui header">
4
+ <%= t('.title') %>
5
+ </div>
6
+
7
+ <div class="content">
8
+ <%= form_with url: assign_admin_maintains_path(add_ids: params[:add_ids]) do |f| %>
9
+ <%= f.collection_select :member_id, @members, :id, :name, can: { wrap_input_id: true } %>
10
+ <%= f.submit %>
11
+ <% end %>
12
+ </div>
13
+ </div>
@@ -0,0 +1,15 @@
1
+ <div class="modal is-active" data-controller="modal">
2
+ <div class="modal-background" data-action="click->modal#close"></div>
3
+ <div class="modal-card">
4
+ <header class="modal-card-head">
5
+ <p class="modal-card-title"><%= t('.new') %></p>
6
+ <button class="delete" data-action="modal#close"></button>
7
+ </header>
8
+ <section class="modal-card-body">
9
+ <%= form_with url: detect_admin_maintains_url do |f| %>
10
+ <%= f.text_field :identity, label: '家长联系方式' %>
11
+ <%= f.submit '下一步' %>
12
+ <% end %>
13
+ </section>
14
+ </div>
15
+ </div>
@@ -0,0 +1,4 @@
1
+ <%= form_with model: @maintain, url: { action: 'create' } do |f| %>
2
+ <% render partial: 'form', locals: { f: f } %>
3
+ <%= f.submit %>
4
+ <% end %>
@@ -0,0 +1 @@
1
+ json.maintain @maintain, partial: 'maintain', as: :maintain
@@ -0,0 +1,54 @@
1
+ <tr>
2
+ <td class="has-text-right"><%= Maintain.human_attribute_name('client.real_name') %></td>
3
+ <td><%= @maintain.client.real_name %></td>
4
+ </tr>
5
+ <tr>
6
+ <td class="has-text-right"><%= Maintain.human_attribute_name('client.nick_name') %></td>
7
+ <td><%= @maintain.client.nick_name %></td>
8
+ </tr>
9
+ <tr>
10
+ <td class="has-text-right"><%= Profile.human_attribute_name(:birthday_type) %></td>
11
+ <td><%= @maintain.client.birthday_type_i18n %></td>
12
+ </tr>
13
+ <tr>
14
+ <td class="has-text-right"><%= Profile.human_attribute_name(:birthday) %></td>
15
+ <td><%= @maintain.client.birthday %></td>
16
+ </tr>
17
+ <tr>
18
+ <td class="has-text-right"><%= Profile.human_attribute_name(:gender) %></td>
19
+ <td><%= @maintain.client.gender_i18n %></td>
20
+ </tr>
21
+ <tr>
22
+ <td class="has-text-right"><%= Maintain.human_attribute_name(:note) %></td>
23
+ <td><%= @maintain.note %></td>
24
+ </tr>
25
+ <tr>
26
+ <td class="has-text-right"><%= Maintain.human_attribute_name('tutelar.real_name') %></td>
27
+ <td><%= @maintain.tutelar.real_name %></td>
28
+ </tr>
29
+ <tr>
30
+ <td class="has-text-right"><%= Maintain.human_attribute_name('tutelar.identity') %></td>
31
+ <td>
32
+ <%= @maintain.tutelar.identity %>
33
+ <% if @maintain.tutelar.user && @maintain.tutelar.account&.wechat_response %>
34
+ <%= image_tag @maintain.tutelar.account.qrcode_url, class: 'ui small image' %>
35
+ <% else %>
36
+ <%= link_to qrcode_admin_profile_path(@maintain.tutelar), method: :patch, id: 'account_qrcode' do %>
37
+ <i class="fas fa-qrcode"></i>
38
+ <% end %>
39
+ <% end %>
40
+ </td>
41
+ </tr>
42
+ <tr>
43
+ <td class="has-text-right"><%= Card.human_name %></td>
44
+ <td>
45
+ <% @maintain.tutelage.cards.each do |card| %>
46
+ <div class="ui image label">
47
+ <%= link_to card.card_uuid, admin_card_card_logs_path(card), text: true %>
48
+ <%= link_to card_admin_agency_path(@maintain.agency, card_id: card.id), method: :delete do %>
49
+ <i class="delete icon"></i>
50
+ <% end %>
51
+ </div>
52
+ <% end %>
53
+ </td>
54
+ </tr>
@@ -0,0 +1,3 @@
1
+ $('#modal').replaceWith('<%= j(render 'create_detect') %>');
2
+ $('#modal').modal({closable: false}).modal('show');
3
+ remote_js_load('<%= raw remote_js_load %>')
@@ -0,0 +1,8 @@
1
+ $('#maintain_pipeline_id').dropdown({
2
+ onChange: function (value, text, $selectedItem) {
3
+ var search_url = new URL('/admin/pipelines/options', location.origin);
4
+ search_url.searchParams.set('pipeline_id', value);
5
+
6
+ Rails.ajax({url: search_url, type: 'GET', dataType: 'script'});
7
+ }
8
+ });
@@ -0,0 +1,3 @@
1
+ $('#modal').replaceWith('<%= j(render 'edit_assign') %>');
2
+ $('#modal').modal({autofocus: false}).modal('show');
3
+ remote_js_load('<%= raw remote_js_load %>')
@@ -0,0 +1,12 @@
1
+ $('#modal').replaceWith('<%= j(render 'edit_order') %>');
2
+ $('#modal').modal({autofocus: false}).modal('show');
3
+ $('#card_template_id').dropdown({
4
+ placeholder: false,
5
+ onChange: function(value, text, $selectedItem){
6
+ var search_url = new URL('admin/card_templates/advance_options', location.origin);
7
+ if (value) {
8
+ search_url.searchParams.set('id', value);
9
+ Rails.ajax({url: search_url, type: 'GET', dataType: 'script'});
10
+ }
11
+ }
12
+ });
@@ -0,0 +1,8 @@
1
+ $('#maintain_pipeline_id').dropdown({
2
+ onChange: function (value, text, $selectedItem) {
3
+ var search_url = new URL('/admin/pipelines/options', location.origin);
4
+ search_url.searchParams.set('pipeline_id', value);
5
+
6
+ Rails.ajax({url: search_url, type: 'GET', dataType: 'script'});
7
+ }
8
+ });
@@ -0,0 +1,3 @@
1
+ $('#modal').replaceWith('<%= j(render 'edit_transfer') %>');
2
+ $('#modal').modal({autofocus: false}).modal('show');
3
+ remote_js_load('<%= raw remote_js_load %>')
@@ -0,0 +1,26 @@
1
+ <td>
2
+ <p class="has-text-grey"><%= maintain.member&.name %></p>
3
+ <p><%= maintain.state_i18n %></p>
4
+ </td>
5
+ <td>
6
+ <%= link_to admin_maintain_maintain_logs_path(maintain), aria: { label: t('crm.admin.maintain_logs.index.title') }, class: 'button is-small is-rounded is-light' do %>
7
+ <i class="fas fa-clock"></i>
8
+ <% end %>
9
+ <%= link_to detach_admin_maintain_path(maintain), method: :patch, aria: { label: t('crm.admin.maintains.index.detach'), confirm: t('.confirm') }, class: 'button is-small is-rounded is-light' do %>
10
+ <i class="fas fa-hand-holding"></i>
11
+ <% end %>
12
+ <% if current_user.admin? || Rails.env.development? %>
13
+ <%= link_to transfer_admin_maintain_path(maintain), aria: { label: t('.transfer') }, class: 'button is-small is-rounded is-light' do %>
14
+ <i class="fas fa-random"></i>
15
+ <% end %>
16
+ <% end %>
17
+ <%= link_to orders_admin_maintain_path(maintain), aria: { label: t('.orders') }, class: 'button is-small is-rounded is-light' do %>
18
+ <i class="fas fa-shopping-cart"></i>
19
+ <% end %>
20
+ <%= link_to edit_admin_maintain_path(maintain), aria: { label: t('.edit') }, class: 'button is-small is-rounded is-light' do %>
21
+ <i class="fas fa-pencil-alt"></i>
22
+ <% end %>
23
+ <%= link_to admin_maintain_path(maintain), method: :delete, aria: { label: t('.destroy') }, data: { confirm: t('.confirm') }, class: 'button is-small is-rounded is-light' do %>
24
+ <i class="fas fa-trash-alt"></i>
25
+ <% end %>
26
+ </td>
@@ -0,0 +1,2 @@
1
+ json.maintains @maintains, partial: 'maintain', as: :maintain
2
+ json.partial! 'shared/pagination', items: @maintains
@@ -0,0 +1,5 @@
1
+ json.tutelages @tutelages do |tutelage|
2
+ json.extract! tutelage, :id, :relation
3
+ json.pupil tutelage.pupil, :id, :real_name, :nick_name, :birthday_type, :birthday, :gender
4
+ json.tutelar tutelage.tutelar, :id, :real_name, :identity, :area_id, :address
5
+ end
@@ -0,0 +1,3 @@
1
+ $('#modal').replaceWith('<%= j(render 'new_batch_assign') %>');
2
+ $('#modal').modal({autofocus: false}).modal('show');
3
+ remote_js_load('<%= raw remote_js_load %>')
@@ -0,0 +1 @@
1
+ document.getElementById('modal').innerHTML = '<%= j(render 'new_detect') %>'
@@ -0,0 +1,54 @@
1
+ <% content_for :breadcrumb do %>
2
+ <div class="ui basic segment breadcrumb">
3
+ <%= link_to t('crm.admin.maintains.index.title'), admin_maintains_path, class: 'section' %>
4
+ <i class="fas fa-angle-right divider"></i>
5
+ <div class="active section"><%= t('.title') %></div>
6
+ </div>
7
+ <% end %>
8
+
9
+ <div class="ui top attached segment">
10
+ <%= render 'trade/admin/orders/filter' %>
11
+ </div>
12
+
13
+ <table class="table is-hoverable is-fullwidth">
14
+ <thead>
15
+ <tr>
16
+ <th><%= Order.human_attribute_name(:uuid) %></th>
17
+ <th><%= Order.human_attribute_name(:amount) %></th>
18
+ <th><%= Order.human_attribute_name(:received_amount) %></th>
19
+ <th><%= Order.human_attribute_name(:payment_status) %></th>
20
+ <th><%= Order.human_attribute_name(:created_at) %></th>
21
+ <th>
22
+ <%= link_to order_admin_maintain_path(@maintain), aria: { label: '购卡' }, class: 'button is-small is-rounded is-light' do %>
23
+ <i class="fas fa-credit-card"></i>
24
+ <% end %>
25
+ </th>
26
+ </tr>
27
+ </thead>
28
+
29
+ <% @orders.each do |order| %>
30
+ <tr id="order_<%= order.id %>">
31
+ <td><%= link_to order.uuid, admin_order_path(order), text: true %></td>
32
+ <td><%= order.amount %></td>
33
+ <td><%= order.received_amount %></td>
34
+ <td>
35
+ <%= order.payment_status_i18n %>
36
+ <% if ['part_paid', 'all_paid'].include?(order.payment_status) %>
37
+ <%= link_to t('.refund'), refund_admin_order_path(order.id), method: :patch, class: 'ui mini gray button' %>
38
+ <% elsif ['refunding', 'refunded', 'denied'].include?(order.payment_status) %>
39
+ <%= link_to t('.refund_list'), admin_refunds_path(order_id: order.id), class: 'button is-link is-small' %>
40
+ <% elsif ['unpaid'].include?(order.payment_status) %>
41
+ <%= link_to t('.add_payment'), new_admin_payment_path(order_id: order.id), class: 'button is-link is-small' %>
42
+ <% end %>
43
+ </td>
44
+ <td><time data-controller="time"><%= order.created_at.to_s(:rfc822) %></time></td>
45
+ <td>
46
+ <%= link_to edit_admin_order_path(order), aria: { label: t('.edit') }, class: 'button is-small is-rounded is-light' do %>
47
+ <i class="fas fa-pencil-alt"></i>
48
+ <% end %>
49
+ </td>
50
+ </tr>
51
+ <% end %>
52
+ </table>
53
+
54
+ <%= paginate @orders %>