django-smartbase-admin 1.0.32__py3-none-any.whl → 1.0.34__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -135,7 +135,14 @@ export default class Autocomplete {
135
135
  })
136
136
  addNewButton?.addEventListener('click', (event) => {
137
137
  choicesJS.clearStore()
138
- choicesJS.setValue([event.currentTarget.dataset.value])
138
+ choicesJS.setValue([
139
+ {
140
+ value:event.currentTarget.dataset.value,
141
+ customProperties: {
142
+ create: true
143
+ }
144
+ }
145
+ ])
139
146
  choicesJS.SBwrapperElButton.click()
140
147
  filterInputValueChangedUtil(inputEl)
141
148
  })
@@ -259,6 +266,7 @@ export default class Autocomplete {
259
266
  choicesJSChoices.push({
260
267
  value: value.value,
261
268
  label: value.label,
269
+ customProperties: value.customProperties,
262
270
  selected: true
263
271
  })
264
272
  })
@@ -49,13 +49,21 @@ export const choicesJSOptions = (choiceInput) => ({
49
49
  })
50
50
 
51
51
 
52
+ const getChoiceValueForInput = (currentValue) => {
53
+ let value = {
54
+ 'value': currentValue.value,
55
+ 'label': currentValue.label,
56
+ }
57
+ if(currentValue.customProperties?.create){
58
+ value['create'] = true
59
+ }
60
+ return value
61
+ }
62
+
52
63
  export const choicesJSListeners = {
53
64
  'selectItem': (item, inputEl) => {
54
65
  if (!item) return
55
- const choiceValue = [{
56
- value: item.value,
57
- label: item.label
58
- }]
66
+ const choiceValue = [getChoiceValueForInput(item)]
59
67
  inputEl.value = JSON.stringify(choiceValue)
60
68
  },
61
69
  'addItem': (choicesJS, inputEl) => {
@@ -63,10 +71,7 @@ export const choicesJSListeners = {
63
71
  let choicesJSValue = choicesJS.getValue()
64
72
  choicesJSValue = Array.isArray(choicesJSValue) ? choicesJSValue : [choicesJSValue]
65
73
  choicesJSValue.forEach(function (currentValue) {
66
- choiceValue.push({
67
- 'value': currentValue.value,
68
- 'label': currentValue.label,
69
- })
74
+ choiceValue.push(getChoiceValueForInput(currentValue))
70
75
  })
71
76
  inputEl.value = JSON.stringify(choiceValue)
72
77
  },
@@ -76,10 +81,7 @@ export const choicesJSListeners = {
76
81
  if (choicesJSValue !== undefined) {
77
82
  choicesJSValue = Array.isArray(choicesJSValue) ? choicesJSValue : [choicesJSValue]
78
83
  choicesJSValue.forEach(function (currentValue) {
79
- choiceValue.push({
80
- 'value': currentValue.value,
81
- 'label': currentValue.label,
82
- })
84
+ choiceValue.push(getChoiceValueForInput(currentValue))
83
85
  })
84
86
  }
85
87
  inputEl.value = JSON.stringify(choiceValue)
@@ -16,7 +16,7 @@ export default class Datepicker {
16
16
  documentLocale = 'default'
17
17
  }
18
18
  flatpickr.localize(this.getLocale(documentLocale))
19
- this.initWidgets()
19
+ this.initWidgets(target)
20
20
  if(target === document) {
21
21
  document.addEventListener('formset:added', (e) => {
22
22
  this.initWidgets(e.target)
@@ -42,7 +42,7 @@
42
42
  <div class="detail-view-header py-16 md:pb-32 flex items-center max-xs:px-20 w-full max-w-1180 mx-auto">
43
43
  {% if not is_popup and has_view_permission and show_back_button %}
44
44
  {% url opts|admin_urlname:'changelist' as changelist_url %}
45
- <a href="{% add_preserved_filters changelist_url %}" class="btn p-0 w-40 mr-16">
45
+ <a href="{% add_preserved_filters back_url %}" class="btn p-0 w-40 mr-16">
46
46
  <svg class="w-20 h-20">
47
47
  <use xlink:href="#Left-small"></use>
48
48
  </svg>
@@ -272,8 +272,7 @@
272
272
  {% endif %}
273
273
  <div class="flex ml-auto gap-8">
274
274
  {% if not is_popup and has_view_permission and show_back_button %}
275
- {% url opts|admin_urlname:'changelist' as changelist_url %}
276
- <a href="{% add_preserved_filters changelist_url %}" class="btn btn-empty">{% trans 'Back' %}</a>
275
+ <a href="{% add_preserved_filters back_url %}" class="btn btn-empty">{% trans 'Back' %}</a>
277
276
  {% endif %}
278
277
 
279
278
  {% submit_row %}
@@ -2,7 +2,7 @@
2
2
  {% with autocomplete_data_id=filter_widget.view_id|add:"-"|add:filter_widget.input_id|add:"_data" %}
3
3
  <div class="relative">
4
4
  {% include 'sb_admin/widgets/includes/field_label.html' %}
5
- <div id="{{ widget.attrs.id }}-wrapper" class="relative flex items-center gap-4 max-w-full overflow-hidden">
5
+ <div id="{{ widget.attrs.id }}-wrapper" class="relative flex items-center max-w-full overflow-hidden{% if widget.attrs.related_edit_url or widget.attrs.related_add_url %} gap-4{% endif %}">
6
6
  <button
7
7
  data-bs-toggle="dropdown"
8
8
  aria-expanded="false"
@@ -1,11 +1,11 @@
1
1
  {% load i18n %}
2
- <div class="flex items-center gap-4 flex-shrink-0 related-item-buttons">
2
+ <div class="flex items-center gap-4 flex-shrink-0 related-item-buttons">
3
3
  {% if widget.attrs.related_edit_url or widget.attrs.related_add_url %}
4
4
  <a
5
5
  class="btn btn-icon edit-button {% if not widget.attrs.related_edit_url %}hidden{% endif %}"
6
6
  title="{% trans 'Edit' %}"
7
7
  {% if widget.attrs.related_edit_url %}
8
- hx-get="{{ widget.attrs.related_edit_url }}?_popup=1&sbadmin_is_modal=1&sb_admin_source_field={{ widget.attrs.id }}"
8
+ hx-get="{{ widget.attrs.related_edit_url }}?_popup=1&sbadmin_is_modal=1&sb_admin_source_field={{ widget.attrs.id }}{% if reload_on_save %}&sbadmin_reload_on_save=1{% endif %}"
9
9
  {% endif %}
10
10
  {% if widget.attrs.related_add_url and not widget.attrs.related_edit_url %}
11
11
  data-add-url="{{ widget.attrs.related_add_url }}?_popup=1&sbadmin_is_modal=1&sb_admin_source_field={{ widget.attrs.id }}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-smartbase-admin
3
- Version: 1.0.32
3
+ Version: 1.0.34
4
4
  Summary:
5
5
  Home-page: https://smartbase-sk.github.io/django-smartbase-admin-docs/
6
6
  License: MIT
@@ -3,9 +3,9 @@ django_smartbase_admin/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
3
3
  django_smartbase_admin/actions/admin_action_list.py,sha256=SzJQBCTj9xhVnbQi8h7LlQowzdZrNOUG1GRBgp2YFCI,19609
4
4
  django_smartbase_admin/actions/advanced_filters.py,sha256=Vm8b6TAwNehR8INjolFG7pEYL4ADO7XUiVOWpb0btM0,13481
5
5
  django_smartbase_admin/admin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- django_smartbase_admin/admin/admin_base.py,sha256=WQ5Zl25ggG7_oD-8Gvm9b2Pg9hPq6dFTVpW11cd2oLc,48144
6
+ django_smartbase_admin/admin/admin_base.py,sha256=9UwjWsZ2i-nGvNSGT7TtzdfJA_3yO2MpJCAv_BsFzbM,49413
7
7
  django_smartbase_admin/admin/site.py,sha256=bU71Zcts2hRcusZq1l44q9Mlr8jOEjGHeM6MNAaS6Gc,9903
8
- django_smartbase_admin/admin/widgets.py,sha256=OhPZfQ7GR6dgS9Yg_OlkFxSva06Hp28_V-40ZxxkFf8,26216
8
+ django_smartbase_admin/admin/widgets.py,sha256=T2_haNKqky_D6tHkzDcxjZzqHeP9DEDi0thcVFiaYCI,34241
9
9
  django_smartbase_admin/apps.py,sha256=heZq5O2GHlkJdhUCHbRR7Nmm0irSxnL9NMqY43_O7V4,599
10
10
  django_smartbase_admin/compilemessages.py,sha256=-_FEFQlOvE4L8UzSuUxSxZQjgGlwL9IZtmg59fW_kIQ,342
11
11
  django_smartbase_admin/engine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -13,17 +13,17 @@ django_smartbase_admin/engine/actions.py,sha256=vmwMmo1mxxHSLTlbNwbH6h9ulxwDVJnF
13
13
  django_smartbase_admin/engine/admin_base_view.py,sha256=NNHAnVVFCEZQq1_pkmb8jZPrw0xlD7ByfeDTIAagLWo,32460
14
14
  django_smartbase_admin/engine/admin_entrypoint_view.py,sha256=jfMfcYPfdre2abHfC4KIxaP_epJFuCeTcujGhGd4Tl4,624
15
15
  django_smartbase_admin/engine/admin_view.py,sha256=9wGffahDR3IYmhL9ZbX8uitwGdXdw5DIL5GnWBawmJM,4238
16
- django_smartbase_admin/engine/configuration.py,sha256=BCEu9N1G6UEtoQ8Ho1LCVGpVPtVOtTXJCjkBJxo5xws,8727
16
+ django_smartbase_admin/engine/configuration.py,sha256=DcmEh-FR3pn6H-_mNBuiml-ILi2v3KEZPC2YYPvnbFE,8752
17
17
  django_smartbase_admin/engine/const.py,sha256=BP5I2UcCtV0bIlk_YUuVFHrDHRM9-gbCL0sJUX-q4Wo,2600
18
18
  django_smartbase_admin/engine/dashboard.py,sha256=yXi0oUTybqeo2_o2G3skp27W79u_SKjqcaXGKXR4pus,24488
19
19
  django_smartbase_admin/engine/fake_inline.py,sha256=tGLX3yHANYBsVPcDk6yQqn8RN-JGdaV-RdHcxh9-61w,6190
20
20
  django_smartbase_admin/engine/field.py,sha256=AkcEs9hYqIJHy9cLgchWfC1wpWTRzFNm7byEIf0DuLU,10858
21
21
  django_smartbase_admin/engine/field_formatter.py,sha256=Ma4GoO2DMgCtx-zy_hgyW_095GWwflMdn8uN4GUatgw,2087
22
- django_smartbase_admin/engine/filter_widgets.py,sha256=jGx1LuuprJ0DxwxbuyN_Oym3HKsqSJjePzyapFBcedo,31881
22
+ django_smartbase_admin/engine/filter_widgets.py,sha256=Pg9uqH22StmfwNkEbML0ytAJFsOtdgmDvmBpVp35h1k,33331
23
23
  django_smartbase_admin/engine/global_filter_form.py,sha256=jlj6e9VYWDPyUNjcgj3gTIkCZXO01NZOWAeU3jFtkoA,249
24
24
  django_smartbase_admin/engine/menu_item.py,sha256=HP5EwjxBYygAg72RsgQyde62DI9CDg_pDzc8FqlUPEc,3028
25
25
  django_smartbase_admin/engine/modal_view.py,sha256=heo9r-RaRm2MuGtPd_fhWM2jRmxtctM-L59YZQOoOvs,2308
26
- django_smartbase_admin/engine/request.py,sha256=sFjxgmzGXUeCD3hEx-Eu-ebgF8CnrBJDH2e8LF1ieRg,2615
26
+ django_smartbase_admin/engine/request.py,sha256=jxYpsepc0SDKUFQFoCXTGLpbTP7eroJEWHO-lcRM5ec,2676
27
27
  django_smartbase_admin/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  django_smartbase_admin/integration/django_cms.py,sha256=OuBrSxGR8Q5sV1i0W0_uWGu62H0MByWZhGaD_v0eGvo,1258
29
29
  django_smartbase_admin/locale/sk/LC_MESSAGES/django.mo,sha256=kZ8PxgEpqxP0b6b4T8vepKnD3Y-WWEbO5ix6Y_t2qVI,17027
@@ -45,7 +45,7 @@ django_smartbase_admin/services/configuration.py,sha256=2sUhoneLKtv0MCaeTEshhWnT
45
45
  django_smartbase_admin/services/data.py,sha256=o36B_H9RnBvaQz3Rs3NygY1hVTr6hc89M-RK1saRXzc,156
46
46
  django_smartbase_admin/services/thread_local.py,sha256=C3x7hPsKRCddr05RGiN0f6fcSQ8qsrYRdx9oeMHRovU,293
47
47
  django_smartbase_admin/services/translations.py,sha256=aiekREx8KQA9CQRmtkUcys4ICJERMrkxPnLysp0YXO8,5606
48
- django_smartbase_admin/services/views.py,sha256=rsgZHHFXwoU6EYZsKyeTZR6QgwcR9N7xWnRmTkItC4Y,9108
48
+ django_smartbase_admin/services/views.py,sha256=_5BfEMAs0ryR528YZjPJgByIqYotm6rV875m7KGlD5s,9136
49
49
  django_smartbase_admin/services/xlsx_export.py,sha256=fnIqahmZR6G5T5wSH-sXhhLSy1QD3A-OY6BAn1WLLOc,10723
50
50
  django_smartbase_admin/static/sb_admin/build/postcss.config.js,sha256=JlIB66vejH4YA3sPp7hDjimQXAGz5WlVhFDwjBDNTEo,610
51
51
  django_smartbase_admin/static/sb_admin/build/tailwind.config.js,sha256=6FE_zEpEhGaCLrCwJq9ZcKBjqgRUdIXvkS28H8zLlt4,2392
@@ -68,9 +68,9 @@ django_smartbase_admin/static/sb_admin/dist/calendar_style.js,sha256=47DEQpj8HBS
68
68
  django_smartbase_admin/static/sb_admin/dist/chart.js,sha256=nBru0P3RvzaNeQch6qkuL1Wi_c9ICz94HXLXmyYTMW8,205022
69
69
  django_smartbase_admin/static/sb_admin/dist/chart.js.LICENSE.txt,sha256=m7M__mzLlrKDz-hky_AC848p_HzYWhziwCLIpXMsj4I,257
70
70
  django_smartbase_admin/static/sb_admin/dist/confirmation_modal.js,sha256=glK-x4oxSAHqiabqXmNFE3FRtzMbpg7TgZiKcPle9_o,1745
71
- django_smartbase_admin/static/sb_admin/dist/main.js,sha256=AWemh0ZBm1ui5I97S4eEL0B7XOtWrOra_oiRL3r3Zso,385214
71
+ django_smartbase_admin/static/sb_admin/dist/main.js,sha256=S9F0bd-rm-541kDyUBrJnFL6RjknCEkED51je35LyAg,385342
72
72
  django_smartbase_admin/static/sb_admin/dist/main.js.LICENSE.txt,sha256=Z8-1IrzhOFV3eE_WGR7SRfbzN9GRXsvfiU7_E_BkX-k,5600
73
- django_smartbase_admin/static/sb_admin/dist/main_style.css,sha256=bBsZfcF9EyNt4f5WIKmFyuG8mn81x9sWjk-EXygekwc,179002
73
+ django_smartbase_admin/static/sb_admin/dist/main_style.css,sha256=NDHU8aKRCoNLtn5GjfpQuraZGHp5yBy1UOTIx0U8bTw,178574
74
74
  django_smartbase_admin/static/sb_admin/dist/main_style.js,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
75
75
  django_smartbase_admin/static/sb_admin/dist/table.js,sha256=ellAKCmVs6r3AjERQ5UZ3NUCLT6uY5KQmGMM-ciyI7I,592340
76
76
  django_smartbase_admin/static/sb_admin/dist/table.js.LICENSE.txt,sha256=WOKSfEow5EUe0a78P0kcxdWcrQlqn2n6H8idNZqHVDk,462
@@ -531,13 +531,13 @@ django_smartbase_admin/static/sb_admin/src/css/components/_toggle.css,sha256=Qiw
531
531
  django_smartbase_admin/static/sb_admin/src/css/components/_tooltip.css,sha256=RnJQcJ-1MX-9jsMOeApuMaMaENJyiD-8UIg8wmDrXRE,2291
532
532
  django_smartbase_admin/static/sb_admin/src/css/style.css,sha256=H0ySPWtk4_EEfS4hygySKjC06ob1EWAy3sDPiGI3HUs,738
533
533
  django_smartbase_admin/static/sb_admin/src/css/tree_widget.css,sha256=dVltYkRkd8DciWc0iMW0hXkTO08LiWcS5PFesRQIr9M,11148
534
- django_smartbase_admin/static/sb_admin/src/js/autocomplete.js,sha256=xqI845bSuseCflXRb7LGo4ozJt70G6PHupYPlFMviro,14402
534
+ django_smartbase_admin/static/sb_admin/src/js/autocomplete.js,sha256=fXYd6Ctt1gsIDdXfpaNTC8sevpbdJKGafl8TyHxvRDg,14652
535
535
  django_smartbase_admin/static/sb_admin/src/js/calendar.js,sha256=FweC-a1YVl4rVoQV8kbXeCflwnBt0moODJCfxARQNl0,2036
536
536
  django_smartbase_admin/static/sb_admin/src/js/chart.js,sha256=kAXTsM3pCasDDmj2HfqOksPts5O87By4HORJX36n3t0,4497
537
- django_smartbase_admin/static/sb_admin/src/js/choices.js,sha256=xyM1j_xDdA_oKou6fUZsr7Hc5zGF0oS8uQmyF5LdaEA,4842
537
+ django_smartbase_admin/static/sb_admin/src/js/choices.js,sha256=Wi9uX67JvYCuVqgFJJboDbs8iGd_nFhTmeJMZUbHpyk,4901
538
538
  django_smartbase_admin/static/sb_admin/src/js/code.js,sha256=Q1jKpTsUZhxhaGDRrqHhs_jn9gZPYjB1xf7VSXfiCd0,486
539
539
  django_smartbase_admin/static/sb_admin/src/js/confirmation_modal.js,sha256=9xycy0sYJfT0SxeDucbOmvg9gHSrBo3KngZjCAHkVMM,3610
540
- django_smartbase_admin/static/sb_admin/src/js/datepicker.js,sha256=Nnc28kngTOnb8d2q6NOFGismUVp6l-sTVeBu3M1DgJY,6704
540
+ django_smartbase_admin/static/sb_admin/src/js/datepicker.js,sha256=wnFhncPKMkodmf75jSd3PHIy9xO_WRFdxFjf6Qsgp7g,6710
541
541
  django_smartbase_admin/static/sb_admin/src/js/datepicker_plugins.js,sha256=DVIyCJpxn8Gx1mx3QHxbRN4nlpJRlilKix6BK_zcUVc,12382
542
542
  django_smartbase_admin/static/sb_admin/src/js/main.js,sha256=Pb-fgKq0xvY50QJuEpjoLkISCST8fOHBnk_Wn-KJySI,20293
543
543
  django_smartbase_admin/static/sb_admin/src/js/multiselect.js,sha256=GuWjIpdkfvXi-oBNdK3gImjrzef4550MKMy71iYrywk,4066
@@ -561,7 +561,7 @@ django_smartbase_admin/static/sb_admin/src/js/table_modules/views_module.js,sha2
561
561
  django_smartbase_admin/static/sb_admin/src/js/translations.js,sha256=GEizlr_D5yDj00i7jKENkWfDr6gZcg4RQ1Nek22WP4g,954
562
562
  django_smartbase_admin/static/sb_admin/src/js/tree_widget.js,sha256=LEu8LNycEIK4drqfUORXDOzFW2EzYg6AWmlM4H35VdM,18426
563
563
  django_smartbase_admin/static/sb_admin/src/js/utils.js,sha256=8hBr_dr1F_SQKLvuh9Z4t3q3KnSP2cmth7-x0Ih2T4w,5500
564
- django_smartbase_admin/templates/sb_admin/actions/change_form.html,sha256=g48e7ikJ6sUFc87F1sZW8SLv5rCY9j858BfO-xKeMfc,16664
564
+ django_smartbase_admin/templates/sb_admin/actions/change_form.html,sha256=XzG1_gstbpryuA5kdsGHNOuQ2YGgQcTuoXVFZQb_ujI,16556
565
565
  django_smartbase_admin/templates/sb_admin/actions/change_password.html,sha256=LhciaKCvlywKMJ6gY9JbEaTkOXjNSFO-mAnWIZfk6sA,3200
566
566
  django_smartbase_admin/templates/sb_admin/actions/dashboard.html,sha256=ur4OFSKJrB71Sl8O5fF0BsV86zLq1tyiadmrDUy9aJ0,297
567
567
  django_smartbase_admin/templates/sb_admin/actions/delete_confirmation.html,sha256=4AeJLqGGPVBYXS9XQSNTnMvsT3I6QttyNLThE8gEZHE,3205
@@ -643,7 +643,6 @@ django_smartbase_admin/templates/sb_admin/integrations/cms/translations_status_r
643
643
  django_smartbase_admin/templates/sb_admin/integrations/filer/filer_change_form.html,sha256=ts8H3F-0VVhxuJfgmPiMo5rGwub5pLzhUx513kw_zVE,3002
644
644
  django_smartbase_admin/templates/sb_admin/integrations/filer/folder_list.html,sha256=FwPER3QByBeWikj8dojedu0BfrYIQpWOSleHxMRc7OE,20733
645
645
  django_smartbase_admin/templates/sb_admin/integrations/filer/image_change_form.html,sha256=CESQuiGfbKdMEq9DRIXfOS-jpz8yr64TJ7R_cs6jZ9M,1909
646
- django_smartbase_admin/templates/sb_admin/integrations/sorting/change_list.html,sha256=2TSTiKZ52Gpp_Jf5EHr4BEUxnxVXdEY9jEHrtn2f5Xc,15190
647
646
  django_smartbase_admin/templates/sb_admin/navigation.html,sha256=PuxzpaX6ZpjtDqNKh1H74agotZRNWNmBeFe0e5Q7Un0,11127
648
647
  django_smartbase_admin/templates/sb_admin/partials/messages/alert_base.html,sha256=F61XeaBMR7YL9wx0VDXdJ9uTlBMNGSMsXmk6IHZuuNk,825
649
648
  django_smartbase_admin/templates/sb_admin/partials/messages/alert_close.html,sha256=-BhLje6G4Ey36hOseZ41WxjmdsMeCOza_2okBn0EWiM,121
@@ -662,7 +661,7 @@ django_smartbase_admin/templates/sb_admin/tailwind_whitelist.html,sha256=EgzEm52
662
661
  django_smartbase_admin/templates/sb_admin/widgets/array.html,sha256=cjiqpotsguIiL8tABvluu4XAkMwAtzXVeCrkjQY4ueI,2791
663
662
  django_smartbase_admin/templates/sb_admin/widgets/attributes.html,sha256=rbjxSWBGU6fHleGDQHELxvRQzrniJiXW3T4IZHD1GtA,3106
664
663
  django_smartbase_admin/templates/sb_admin/widgets/attrs.html,sha256=9ylIPv5EZg-rx2qPLgobRkw6Zq_WJSM8kt106PpSYa0,172
665
- django_smartbase_admin/templates/sb_admin/widgets/autocomplete.html,sha256=gH3lWi4bhEltUVr1g1reTN_OxizRmaThfzkRNY_W7pc,3373
664
+ django_smartbase_admin/templates/sb_admin/widgets/autocomplete.html,sha256=qPYLKHQ9C6A5jS1a3oS9XFraQ9TFkF5cOiK_phg7Gy0,3453
666
665
  django_smartbase_admin/templates/sb_admin/widgets/checkbox.html,sha256=3mLOCRwBpmV5WriUmRQ3SfD4xTWXe98irbQfZwdmbk0,232
667
666
  django_smartbase_admin/templates/sb_admin/widgets/checkbox_dropdown.html,sha256=ve4QM-cXdEfkNAzNjtMMPAjJHR8mtAuBvskWrBAiBSY,1607
668
667
  django_smartbase_admin/templates/sb_admin/widgets/checkbox_group.html,sha256=IrWfLAmqftF1q9N9QPlLxnj7Lq3xxYPDXUdJnWpW_O4,467
@@ -680,7 +679,7 @@ django_smartbase_admin/templates/sb_admin/widgets/hidden.html,sha256=NGn3jCAoRjA
680
679
  django_smartbase_admin/templates/sb_admin/widgets/html_read_only.html,sha256=GBg8quVgHSJqNxRzkm56YZ4isWLzd1Wlz4CRmukz8i0,18
681
680
  django_smartbase_admin/templates/sb_admin/widgets/includes/field_label.html,sha256=1TdNDxKXM5wScPQxgvRy0ikVsmj0GTJi2YPM8UlrWTQ,148
682
681
  django_smartbase_admin/templates/sb_admin/widgets/includes/help_text.html,sha256=QXYllkl2cmu7tLkWCgiEJis7cYzi9qzqFle2gK_GJXY,148
683
- django_smartbase_admin/templates/sb_admin/widgets/includes/related_item_buttons.html,sha256=OeBQJh1MR1Ue0HFyPuclbG_vaFYqDD4d0cIIE0I_FbQ,1770
682
+ django_smartbase_admin/templates/sb_admin/widgets/includes/related_item_buttons.html,sha256=35sguRd_2LgwRaWS_qljM8ghnhkOV7H0Ueuqo3iaJOY,1828
684
683
  django_smartbase_admin/templates/sb_admin/widgets/includes/simple_field_label.html,sha256=P6XBwmJmcQbb1YhKnEB6wnfP2cN59T8U0GnUt5s_oWo,443
685
684
  django_smartbase_admin/templates/sb_admin/widgets/input.html,sha256=S-ClLUAP-ZdYxv77KQcBWD2JcrKDEyxHuNPPRhfAywk,185
686
685
  django_smartbase_admin/templates/sb_admin/widgets/input_option.html,sha256=6If56Z3ifRFpfpu0ukcs_RINx0goc6SjFJanAH3Wey8,209
@@ -716,7 +715,7 @@ django_smartbase_admin/views/global_filter_view.py,sha256=eYo1moJGyi7jc2cPDA5ZBi
716
715
  django_smartbase_admin/views/media_view.py,sha256=5BLWXuzynF7nM34t-mf2BQSRN5ojY8HxpLIqt7Jiq9g,292
717
716
  django_smartbase_admin/views/translations_view.py,sha256=hktmkJIZ0EJxgnzjHLIoRDY0ckFa5wkbaoFZg32UWYw,20441
718
717
  django_smartbase_admin/views/user_config_view.py,sha256=hUSmwxgGXJog7vhiD-zGpm6smo31sLNzW2VoXapHIjc,1865
719
- django_smartbase_admin-1.0.32.dist-info/LICENSE.md,sha256=okRGMBOYvyhprt2eTpX_QXqpzC0MODF-U7zX-4fKPjQ,1078
720
- django_smartbase_admin-1.0.32.dist-info/METADATA,sha256=RZ4PELcKQjSse0kTBGcmRQbuYAs2pb0eEowomMCb9Lk,6573
721
- django_smartbase_admin-1.0.32.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
722
- django_smartbase_admin-1.0.32.dist-info/RECORD,,
718
+ django_smartbase_admin-1.0.34.dist-info/LICENSE.md,sha256=okRGMBOYvyhprt2eTpX_QXqpzC0MODF-U7zX-4fKPjQ,1078
719
+ django_smartbase_admin-1.0.34.dist-info/METADATA,sha256=EnA4uc7_I7-AsdkPsPtLFFv_IcnsH1skYaOWv2tYIok,6573
720
+ django_smartbase_admin-1.0.34.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
721
+ django_smartbase_admin-1.0.34.dist-info/RECORD,,
@@ -1,401 +0,0 @@
1
- {% extends list_base_template|default:"sb_admin/actions/list.html" %}
2
- {% load static i18n thumbnail admin_list smartshop_tags %}
3
-
4
- {% block tabulator_custom_header %}
5
- {% include 'sb_admin/components/filters.html' with filters=content_context.filters all_filters_visible=True %}
6
- {% endblock %}
7
- {% block tabulator_body %}
8
- {{ block.super }}
9
- {% if category_id and alias_id %}
10
- <div id="sortable-items" class="flex flex-wrap pt-10 pl-10">
11
- {% for item in data.data %}
12
- {% block promo_card %}
13
- {% if promo_cards and forloop.counter in promo_cards %}
14
- {% for promo_card in promo_cards|get_attr_from_dict:forloop.counter %}
15
- <div class="item-card-wrapper border-2 border-solid border-black mr-10 mb-10"
16
- data-group-key="null"
17
- data-order="-{{ promo_card.id }}"
18
- style="{{ promo_card.styles }}">
19
- <div class="promo-card item">
20
- {{ promo_card.id }} - {{ promo_card.name }}
21
- P: <span class="counter"></span><br>
22
- </div>
23
- </div>
24
- {% endfor %}
25
- {% endif %}
26
- {% endblock %}
27
- {% block item %}
28
- <div class="item-wrapper visible cursor-pointer border-2 border-solid border-black mr-10 mb-10" data-group-key="{{ item.group_by_catalog_value }}"
29
- data-order="{{ item.product_category_order_by }}" data-simple-order="{{ forloop.counter }}">
30
- <div class="item">
31
- <img height="76" width="57" class="lazyload" src="{{ LAZY_LOAD_DEFAULT_IMAGE }}" data-src="{% thumbnail item.product_image '76x57' crop=True replace_alpha='#fff' %}" alt="">
32
- {% block sorting_product_attributes %}
33
- P: <span class="counter"></span><input type="checkbox" class="ml-10" name="item-selection" value="{{ item.product_category_order_by }}"><br>
34
- {{ item.product_name }}<br>
35
- {{ item.sorting_identifier|default_if_none:'' }}<br>
36
- {% endblock %}
37
- </div>
38
- </div>
39
- {% endblock %}
40
- {% endfor %}
41
- </div>
42
- {% else %}
43
- <div class="flex-center m-10 mb-30 text-dark-900 text-20">
44
- {% trans "Please select a category and domain(in bottom left corner) to sort." %}
45
- </div>
46
- {% endif %}
47
- {% endblock %}
48
-
49
- {% block content %}
50
- {{ block.super }}
51
- <div class="detail-view-action-bar hidden">
52
- <div>
53
- <h2 class="text-dark-900 font-semibold text-18 mr-16 line-clamp-1">
54
- {% trans 'Operations' %}
55
- </h2>
56
- <div id="sorting-controls" class="flex ml-auto gap-8 items-end">
57
- <button type="button" id="to_first" class="btn btn-secondary">{% trans 'Move to first' %}</button>
58
- <div>
59
- <input type="number" placeholder="{% trans 'Position' %}" name="position" class="input" id="position">
60
- </div>
61
- <button type="button" id="to_position" class="btn btn-secondary">{% trans 'Set' %}</button>
62
- </div>
63
- </div>
64
- </div>
65
- {% endblock %}
66
-
67
- {% block style_init %}
68
- <style>
69
- .tabulator, .tabulator-custom-footer {
70
- display: none;
71
- }
72
-
73
- .sortable-selected .item {
74
- border: 1px solid rgba(27, 33, 255, 0.5) !important;
75
- }
76
-
77
- #sortable-items {
78
- height: calc(100vh - 198px);
79
- overflow: auto;
80
- }
81
-
82
- #sortable-items .item {
83
- padding: 10px;
84
- display: none;
85
- }
86
-
87
- #sortable-items .item-card-wrapper .item {
88
- display: block;
89
- }
90
-
91
- #sortable-items .item-wrapper {
92
- width: calc(12.5% - 14px) !important;
93
- height: 130px;
94
- position: relative;
95
- }
96
-
97
- #sortable-items .item-wrapper.visible .item {
98
- display: block;
99
- }
100
-
101
- #sortable-items .item-wrapper.visible .item img {
102
- padding-right: 5px;
103
- float: left;
104
- width: auto;
105
- }
106
-
107
- #sortable-items .item-wrapper.page-end::after {
108
- content: " ";
109
- position: absolute;
110
- display: block;
111
- height: 100%;
112
- width: 10px;
113
- background: red;
114
- margin-left: 100%;
115
- top: 0;
116
- right: -10px;
117
- }
118
-
119
- #clipboard {
120
- display: flex;
121
- flex-wrap: wrap;
122
- width: 100%;
123
- height: 30px;
124
- border: 1px solid red;
125
- }
126
-
127
- #clipboard .product-name {
128
- display: none;
129
- }
130
-
131
- #clipboard img {
132
- height: 30px;
133
- }
134
-
135
- .paginator .item-wrapper {
136
- display: none;
137
- }
138
-
139
- #reorder-overlay {
140
- background: #ffffff8f;
141
- position: absolute;
142
- top: 0;
143
- left: 0;
144
- right: 0;
145
- bottom: 0;
146
- z-index: 9999;
147
- }
148
-
149
- #reorder-overlay:after {
150
- content: '{% trans 'Reordering please wait' %}';
151
- position: absolute;
152
- top: 50%;
153
- left: 50%;
154
- transform: translate(-50%, -50%);
155
- font-size: 32px;
156
- font-weight: bold;
157
- }
158
-
159
- form input[type=checkbox] {
160
- width: 18px !important;
161
- cursor: pointer;
162
- }
163
-
164
- html, body {
165
- overflow: auto;
166
- }
167
- </style>
168
- {% endblock %}
169
-
170
- {% block additional_js %}
171
- {{ block.super }}
172
- <script>
173
- document.addEventListener('SBAdminTableNewURL', () => {
174
- setTimeout(() => {
175
- window.location.reload()
176
- }, 1)
177
- })
178
- </script>
179
- <script src="{% static 'components/tiles/js/lodash.min.js' %}"></script>
180
- <script src="{% static 'js/sortable.min.js' %}"></script>
181
- <script src="{% static 'sb_admin/js/lazysizes.min.js' %}"></script>
182
- <script>
183
- const mainSorting = () => {
184
- const requestQueue = [];
185
- const perPage = {{ content_context.tabulator_definition.tableInitialPageSize }};
186
- const reorderUrl = '{{ reorder_url }}';
187
- const pageSize = 24;
188
- const numberingFrom = 0;
189
- const overlayId = 'reorder-overlay';
190
- let overlayEl = document.createElement('div');
191
- overlayEl.setAttribute("id", overlayId);
192
- let isRequested = false;
193
-
194
- function toggleActionbar() {
195
- const lenChecked = document.querySelectorAll('[name="item-selection"]:checked').length;
196
- if (lenChecked > 0) {
197
- document.querySelector('.detail-view-action-bar').classList.remove('hidden')
198
- } else {
199
- document.querySelector('.detail-view-action-bar').classList.add('hidden')
200
- }
201
- }
202
-
203
- document.querySelectorAll('[name="item-selection"]').forEach(el => {
204
- el.addEventListener('change', (e) => {
205
- toggleActionbar();
206
- })
207
- })
208
-
209
- function processQueue() {
210
- if (!isRequested) {
211
- const formData = requestQueue.shift();
212
- if (!formData) {
213
- return
214
- }
215
- isRequested = true;
216
- fetch('', {
217
- method: 'POST',
218
- body: formData,
219
- redirect: "manual"
220
- }).then(response => {
221
- return response;
222
- }).then((response) => {
223
- if (response.type === "opaqueredirect") {
224
- addOverlay();
225
- requestReorder().then((response) => {
226
- requestQueue.unshift(formData);
227
- isRequested = false;
228
- processQueue();
229
- removeOverlay();
230
- }).catch((err) => {
231
- window.location = response.url
232
- })
233
- } else {
234
- isRequested = false;
235
- processQueue();
236
- }
237
- }).catch(error => {
238
- console.log(error)
239
- }).finally(() => {
240
- });
241
- }
242
- }
243
-
244
- function callApi(group_keys, prev_group_key, position) {
245
- const formData = new FormData();
246
- const promoCardsIndexed = getPromoCardIndexes();
247
- changeOrders();
248
- formData.append('csrfmiddlewaretoken', '{{ csrf_token }}');
249
- formData.append('promo_cards_indexes', JSON.stringify(promoCardsIndexed));
250
- group_keys.forEach(item => {
251
- if (item) {
252
- formData.append('group_keys[]', item);
253
- }
254
- })
255
- if (prev_group_key) {
256
- formData.append('prev_group_key', prev_group_key);
257
- }
258
- if (position) {
259
- formData.append('position', position);
260
- }
261
- requestQueue.push(formData);
262
- processQueue();
263
- }
264
-
265
- function moveSelectedToAbsolutePosition(position) {
266
- console.log(position)
267
- let selectedItems = [];
268
- let selectedItemsGroupKeys = [];
269
- let selectedItemObjs = [];
270
- let selectedItem = null;
271
-
272
- document.querySelectorAll("input[name='item-selection']:checked").forEach(el => {
273
- selectedItemObjs.push(el);
274
- selectedItems.push(el.value);
275
- selectedItemsGroupKeys.push(el.closest('.item-wrapper').dataset.groupKey);
276
- el.checked = false;
277
- })
278
- toggleActionbar();
279
-
280
- let order = window.sortable.toArray();
281
- let orderWithoutSelected = order.filter(function (x) {
282
- return selectedItems.indexOf(x) < 0;
283
- });
284
- let relativePositionOnPage = position - numberingFrom;
285
- if (relativePositionOnPage < 0 || relativePositionOnPage > perPage) {
286
- selectedItemObjs.forEach(elem => elem.closest('.item-wrapper').remove())
287
- } else {
288
- let newOrder = orderWithoutSelected.slice(0, relativePositionOnPage).concat(selectedItems.concat(orderWithoutSelected.slice(relativePositionOnPage)));
289
-
290
- let oldAnimate = window.sortable.options.animation;
291
- if (Math.abs(selectedItemObjs[0].closest('.item-wrapper').dataset.simpleOrder - position) > 40) {
292
- /* disable animation if position difference is too large and animation becomes laggy */
293
- window.sortable.options.animation = 0;
294
- }
295
-
296
- window.sortable.sort(newOrder, true);
297
- window.sortable.options.animation = oldAnimate;
298
- }
299
-
300
- callApi(selectedItemsGroupKeys, null, position);
301
- }
302
-
303
- function getPromoCardIndexes() {
304
- const order = window.sortable.toArray();
305
- const promoCards = {};
306
- order.forEach((element, index) => {
307
- if (element < 0) {
308
- promoCards[Math.abs(element)] = index + 1;
309
- }
310
- });
311
- return promoCards;
312
- }
313
-
314
- function getPrevNotPromo(el) {
315
- let prev = el.previousElementSibling;
316
- while (prev && prev.dataset.order < 0) {
317
- prev = prev.previousElementSibling;
318
- }
319
- return prev;
320
- }
321
-
322
- function requestReorder() {
323
- return fetch(reorderUrl, {
324
- method: 'GET',
325
- })
326
- }
327
-
328
- function addOverlay() {
329
- if (!document.getElementById(overlayId)) {
330
- document.body.appendChild(overlayEl);
331
- }
332
- }
333
-
334
- function removeOverlay() {
335
- if (document.getElementById(overlayId)) {
336
- document.body.removeChild(overlayEl);
337
- }
338
- }
339
-
340
- function changeOrders() {
341
- document.querySelectorAll('[data-order]').forEach((el, index) => {
342
- el.querySelector('.counter').innerText = numberingFrom + index + 1;
343
- });
344
- markPageEnds();
345
- }
346
-
347
- function markPageEnds() {
348
- document.querySelectorAll('.item-wrapper').forEach((el, index) => {
349
- if ((index + 1) % pageSize === 0) {
350
- el.classList.add('page-end');
351
- } else if (el.classList.contains("page-end")) {
352
- el.classList.remove("page-end")
353
- }
354
- });
355
- }
356
-
357
- document.getElementById('to_first').addEventListener('click', () => {
358
- moveSelectedToAbsolutePosition(0);
359
- });
360
- document.getElementById('position').addEventListener('keypress', (event) => {
361
- if (event.key === 'Enter') {
362
- moveSelectedToAbsolutePosition(document.getElementById('position').value - 1);
363
- }
364
- });
365
- document.getElementById('to_position').addEventListener('click', () => {
366
- moveSelectedToAbsolutePosition(document.getElementById('position').value - 1);
367
- });
368
- let items = document.getElementById('sortable-items');
369
- changeOrders();
370
- window.sortable = Sortable.create(items, {
371
- group: 'shared',
372
- animation: 150,
373
- selectedClass: "sortable-selected",
374
- ghostClass: "sortable-ghost",
375
- dragClass: "sortable-drag",
376
- dataIdAttr: 'data-order',
377
- scroll: true,
378
- scrollSensitivity: 100,
379
- bubbleScroll: true,
380
- /* Called by any change to the list (add / update / remove) */
381
- onSort: function (/**Event*/evt) {
382
- console.log(evt)
383
- const prev = getPrevNotPromo(evt.item);
384
- callApi(
385
- [evt.item.dataset.groupKey],
386
- prev ? prev.dataset.groupKey : null,
387
- null
388
- )
389
- },
390
- });
391
- const unique_length = [...new Set(window.sortable.toArray())].length;
392
- const all_length = window.sortable.toArray().length;
393
- if (unique_length !== all_length) {
394
- alert('Something is wrong with ordering.')
395
- }
396
- markPageEnds();
397
- }
398
-
399
- mainSorting()
400
- </script>
401
- {% endblock %}