diff --git a/addons/default/visiosoft/advs-module/migrations/2021_04_27_143550_visiosoft.module.advs__change_product_options_value.php b/addons/default/visiosoft/advs-module/migrations/2021_04_27_143550_visiosoft.module.advs__change_product_options_value.php new file mode 100644 index 000000000..1351744ff --- /dev/null +++ b/addons/default/visiosoft/advs-module/migrations/2021_04_27_143550_visiosoft.module.advs__change_product_options_value.php @@ -0,0 +1,35 @@ +getDatabasePlatform()->registerDoctrineTypeMapping('point', 'string'); + } + + public function up() + { + if (!$field = $this->fields()->findBySlugAndNamespace('product_options_value', 'advs')) { + return; + } + + $field->setAttribute('type', 'visiosoft.field_type.multiple'); + + $this->fields()->save($field); + } + + public function down() + { + if (!$field = $this->fields()->findBySlugAndNamespace('product_options_value', 'advs')) { + return; + } + + $field->setAttribute('type', 'anomaly.field_type.multiple'); + + $this->fields()->save($field); + } +} diff --git a/addons/default/visiosoft/advs-module/resources/config/settings/sections.php b/addons/default/visiosoft/advs-module/resources/config/settings/sections.php index 4c9b427ee..fa22e92a1 100644 --- a/addons/default/visiosoft/advs-module/resources/config/settings/sections.php +++ b/addons/default/visiosoft/advs-module/resources/config/settings/sections.php @@ -18,12 +18,12 @@ return [ 'tcmb_exchange_url', 'enabled_currencies', 'disable_sentry', + 'hide_ad_cat', ], ], 'ads' => [ 'title' => 'visiosoft.module.advs::section.ads', 'fields' => [ - 'detailed_product_options', 'latest-limit', 'popular_ads_limit', 'ads_image_limit', @@ -52,6 +52,7 @@ return [ 'create_ad' => [ 'title' => 'visiosoft.module.advs::section.create_ad', 'fields' => [ + 'detailed_product_options', 'steps_color', 'create_ad_button_color', 'hide_standard_price_field', diff --git a/addons/default/visiosoft/advs-module/resources/config/settings/settings.php b/addons/default/visiosoft/advs-module/resources/config/settings/settings.php index 17d62e30b..d0419b05c 100644 --- a/addons/default/visiosoft/advs-module/resources/config/settings/settings.php +++ b/addons/default/visiosoft/advs-module/resources/config/settings/settings.php @@ -449,4 +449,10 @@ return [ 'default_value' => false, ] ], + 'hide_ad_cat' => [ + 'type' => 'anomaly.field_type.boolean', + 'config' => [ + 'default_value' => false, + ] + ], ]; diff --git a/addons/default/visiosoft/advs-module/resources/css/new-create-new.scss b/addons/default/visiosoft/advs-module/resources/css/new-create-new.scss new file mode 100644 index 000000000..ca1269cc7 --- /dev/null +++ b/addons/default/visiosoft/advs-module/resources/css/new-create-new.scss @@ -0,0 +1,262 @@ +/* Main styles */ +html { + font-size: 12px; + @media only screen and (min-width: 576px) { + font-size: 7.5789px; + } + @media only screen and (min-width: 768px) { + font-size: 10.1052px; + } + @media only screen and (min-width: 992px) { + font-size: 13.4736px; + } + @media only screen and (min-width: 1200px) { + font-size: 16px; + } +} + +label { + margin-bottom: 0; +} +/* End Main styles */ + +#pageTitle { + margin: 2rem 0; + @media only screen and (min-width: 576px) { + margin: 4rem 0; + } + + h1 { + font-weight: 700; + } + + h2 { + color: #707070; + font-size: calc(24rem / 16); + font-weight: 400; + } +} + +#contactInfo { + background-color: #FBFBFD; + padding: 1.4rem 1rem 1.5rem; + @media only screen and (min-width: 576px) { + padding: 2.4rem 4rem 5.5rem; + } + + h3 { + color: #6E5DDB; + font-size: calc(26rem / 16); + margin-bottom: 2rem; + } + + #reachInfo { + font-family: 'Poppins', sans-serif; + margin-bottom: 2rem; + + p { + color: #4A4A4A; + font-size: calc(14rem / 16); + font-weight: 600; + } + + div { + label { + color: #505050; + font-size: calc(18rem / 16); + font-weight: 500; + } + } + } + + #contactSummary { + font-family: 'Poppins', sans-serif; + margin-bottom: 1rem; + @media only screen and (min-width: 576px) { + margin-bottom: 2rem; + } + + label { + font-size: calc(14rem / 16); + color: #4A4A4A; + width: 100%; + font-weight: 600; + margin-bottom: 1rem; + @media only screen and (min-width: 576px) { + width: 32.4%; + margin-bottom: 0; + } + + input { + box-shadow: 0 calc(1rem / 16) calc(2rem / 16) rgba(0, 0, 0, .04); + font-size: calc(17rem / 16); + padding: 1.1rem 1.5rem; + color: #707070; + } + } + } + + #editContact { + button { + color: #0075FF; + background: none; + font-size: calc(18rem / 16); + + svg { + height: 1.08rem; + width: auto; + } + + span { + margin-left: .75rem; + } + } + } +} + +#mainInfo { + background-color: #FBFBFD; + padding: 1.4rem 1rem 2.3rem; + @media only screen and (min-width: 576px) { + padding: 2.4rem 4rem 4.3rem; + } + + h3 { + color: #6E5DDB; + font-size: calc(26rem / 16); + margin-bottom: 2rem; + } + + label { + font-family: 'Poppins', sans-serif; + font-size: calc(14rem / 16); + color: #4A4A4A; + font-weight: 600; + + input { + box-shadow: 0 calc(1rem / 16) calc(2rem / 16) rgba(0, 0, 0, .04); + font-size: calc(17rem / 16); + padding: 1.1rem 1.5rem; + color: #707070; + } + } + + #stockInput { + flex-wrap: wrap; + @media only screen and (min-width: 576px) { + flex-wrap: nowrap; + } + + & > label { + width: 100%; + @media only screen and (min-width: 576px) { + width: 47.5%; + } + + &:not(.d-none) + div { + top: .6rem; + } + + &.d-none + div { + margin-bottom: .5rem; + } + } + + div { + position: relative; + margin: 1rem 0; + @media only screen and (min-width: 576px) { + margin: 0; + width: 47.5%; + } + + svg { + width: 2.2rem; + height: auto; + } + + label { + position: relative; + top: .25rem; + font-weight: 500; + font-size: calc(16rem / 16); + } + } + } + + #priceInput { + & > div { + ::placeholder { + color: #B9C0CF; + opacity: 1; + } + + :-ms-input-placeholder { + color: #B9C0CF; + } + + ::-ms-input-placeholder { + color: #B9C0CF; + } + + input, select { + box-shadow: 0 calc(1rem / 16) calc(2rem / 16) rgba(0, 0, 0, .04); + font-size: calc(17rem / 16); + padding: 1.1rem 1.5rem; + color: #707070; + } + + &:first-child { + @media only screen and (min-width: 576px) { + width: 47.5%; + } + + input { + &.decimal-price { + width: 17%; + } + } + } + + &:last-child { + @media only screen and (min-width: 576px) { + width: 50.75%; + } + + select, .decimal-price { + width: 17%; + } + + select { + padding: 1.1rem 1rem; + } + } + } + } + + #simpleOptionsInput { + .select2-selection { + box-shadow: 0 calc(1rem / 16) calc(2rem / 16) rgba(0, 0, 0, .04); + font-size: calc(17rem / 16); + padding: 1.1rem 1.5rem; + color: #707070; + border: 0; + margin-top: 1rem; + + .select2-selection__rendered { + padding: 0; + display: flex; + margin: 0; + flex-wrap: wrap; + + .select2-selection__choice { + float: none; + } + + .select2-search__field { + padding: 0; + } + } + } + } +} \ No newline at end of file diff --git a/addons/default/visiosoft/advs-module/resources/images/create/contact-edit.svg b/addons/default/visiosoft/advs-module/resources/images/create/contact-edit.svg new file mode 100644 index 000000000..3364c1de2 --- /dev/null +++ b/addons/default/visiosoft/advs-module/resources/images/create/contact-edit.svg @@ -0,0 +1,3 @@ + + + diff --git a/addons/default/visiosoft/advs-module/resources/images/create/safe-cart.svg b/addons/default/visiosoft/advs-module/resources/images/create/safe-cart.svg new file mode 100644 index 000000000..f1b119b11 --- /dev/null +++ b/addons/default/visiosoft/advs-module/resources/images/create/safe-cart.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/addons/default/visiosoft/advs-module/resources/js/editContactInformation.js b/addons/default/visiosoft/advs-module/resources/js/editContactInformation.js index 7b852843d..2eb662a00 100644 --- a/addons/default/visiosoft/advs-module/resources/js/editContactInformation.js +++ b/addons/default/visiosoft/advs-module/resources/js/editContactInformation.js @@ -11,14 +11,21 @@ $('.formEditInfo').on('submit', function (e) { $.ajax({ type: 'POST', - data: form.serialize() + "&action=update", + data: { + action: 'update', + first_name: $('input[name=first_name]', form).val(), + last_name: $('input[name=last_name]', form).val(), + gsm_phone: $('#gsm_phone', form).val(), + office_phone: $('#office_phone', form).val(), + land_phone: $('#land_phone', form).val(), + }, url: '/ajax/update-user-info', success: function (response) { if (response.status == "success") { var profile = response.data; - $('.infoName').html(profile.first_name + " " + profile.last_name); - $('.infoGsmPhone').html(profile.gsm_phone); - $('.infoOfficePhone').html(profile.office_phone); + $('.infoName').val(profile.first_name + " " + profile.last_name); + $('.infoGsmPhone').val(profile.gsm_phone); + $('.infoOfficePhone').val(profile.office_phone); $('.infoLandPhone').html(profile.land_phone); $('#editMyInfo').modal('hide'); diff --git a/addons/default/visiosoft/advs-module/resources/lang/ar/field.php b/addons/default/visiosoft/advs-module/resources/lang/ar/field.php index 38db2753c..7b7fa0237 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/ar/field.php +++ b/addons/default/visiosoft/advs-module/resources/lang/ar/field.php @@ -336,6 +336,7 @@ return [ 'ad_location' => 'موقع الإعلان', 'owner' => 'صاحب', 'default_owner_instruction' => 'سيتحول المالك إلى المستخدم الحالي افتراضيًا إذا لم يتم تحديد أي مستخدم', + 'create_page_subtitle' => 'قم بإنشاء الإعلان بشكل لا تشوبه شائبة عن طريق إدخال معلومات مفصلة حول إعلانك.', // Listing page 'ad_title' => 'عنوان الاعلان', @@ -343,7 +344,7 @@ return [ 'view' => 'منظر', 'ads_with_map' => 'الإعلانات مع الخريطة', 'advanced_sorting' => 'الفرز المتقدم', - 'filter_by_word' => 'Filter by word', + 'filter_by_word' => 'تصفية بالكلمة', 'free' => 'مجانا', 'ad_date' => 'تاريخ الإعلان', @@ -367,4 +368,5 @@ return [ 'old_price' => [ 'name' => 'سعر قديم' ], + 'save_search' => 'حفظ البحث', ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/ar/setting.php b/addons/default/visiosoft/advs-module/resources/lang/ar/setting.php index 7aff1b496..dd3b0dc19 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/ar/setting.php +++ b/addons/default/visiosoft/advs-module/resources/lang/ar/setting.php @@ -264,5 +264,12 @@ return [ ], 'show_subcats_mobile' => [ 'name' => 'إظهار الفئات الفرعية على طريقة عرض الجوال', - ] + ], + 'show_price_to_members_only' => [ + 'name' => 'عرض السعر للأعضاء فقط', + ], + 'hide_ad_cat' => [ + 'name' => 'إخفاء الفئات', + 'instructions' => 'إخفاء الفئات في قائمة الإعلانات' + ] ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/de/field.php b/addons/default/visiosoft/advs-module/resources/lang/de/field.php index 4c9ec42d2..018bf7d5a 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/de/field.php +++ b/addons/default/visiosoft/advs-module/resources/lang/de/field.php @@ -337,6 +337,7 @@ return [ 'ad_location' => 'Anzeigenposition', 'owner' => 'Inhaber', 'default_owner_instruction' => 'Der Eigentümer verwendet standardmäßig den aktuellen Benutzer, wenn kein Benutzer ausgewählt ist', + 'create_page_subtitle' => 'Erstellen Sie die Anzeige fehlerfrei, indem Sie detaillierte Informationen zu Ihrer Anzeige eingeben.', // Listing page 'ad_title' => 'Anzeigentitel', @@ -344,7 +345,7 @@ return [ 'view' => 'Aussicht', 'ads_with_map' => 'Anzeigen mit Karte', 'advanced_sorting' => 'Erweiterte Sortierung', - 'filter_by_word' => 'Filter by word', + 'filter_by_word' => 'Nach Wort filtern', 'free' => 'Frei', 'ad_date' => 'Anzeigedatum', @@ -368,4 +369,5 @@ return [ 'old_price' => [ 'name' => 'Alter Preis' ], + 'save_search' => 'Sichere Suche', ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/de/setting.php b/addons/default/visiosoft/advs-module/resources/lang/de/setting.php index 7680adaa8..11fd1192f 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/de/setting.php +++ b/addons/default/visiosoft/advs-module/resources/lang/de/setting.php @@ -264,5 +264,12 @@ return [ ], 'show_subcats_mobile' => [ 'name' => 'Unterkategorien in der mobilen Ansicht anzeigen', - ] + ], + 'show_price_to_members_only' => [ + 'name' => 'Preis nur für Mitglieder anzeigen', + ], + 'hide_ad_cat' => [ + 'name' => 'Kategorien ausblenden', + 'instructions' => 'Kategorien in der Anzeigenliste ausblenden' + ] ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/field.php b/addons/default/visiosoft/advs-module/resources/lang/en/field.php index 5ebad24af..4a91c0852 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/field.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/field.php @@ -336,6 +336,7 @@ return [ 'ad_location' => 'Ad Location', 'owner' => 'Owner', 'default_owner_instruction' => 'The owner will default to the current user if no user is selected', + 'create_page_subtitle' => 'Create the ad flawlessly by entering detailed information about your ad.', // Listing page 'ad_title' => 'Ad title', @@ -367,4 +368,5 @@ return [ 'old_price' => [ 'name' => 'Old Price' ], + 'save_search' => 'Save Search', ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/setting.php b/addons/default/visiosoft/advs-module/resources/lang/en/setting.php index f60609297..58201c5c2 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/setting.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/setting.php @@ -268,4 +268,8 @@ return [ 'show_price_to_members_only' => [ 'name' => 'Show Price To Members Only', ], + 'hide_ad_cat' => [ + 'name' => 'Hide Categories', + 'instructions' => 'Hide categories in ads list' + ] ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/fr/field.php b/addons/default/visiosoft/advs-module/resources/lang/fr/field.php index 658e02eed..0cf2fa7f8 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/fr/field.php +++ b/addons/default/visiosoft/advs-module/resources/lang/fr/field.php @@ -337,6 +337,7 @@ return [ 'ad_location' => 'Emplacement de l\'annonce', 'owner' => 'Propriétaire', 'default_owner_instruction' => 'Le propriétaire utilisera par défaut l\'utilisateur actuel si aucun utilisateur n\'est sélectionné', + 'create_page_subtitle' => 'Créez parfaitement l\'annonce en saisissant des informations détaillées sur votre annonce.', // Listing page 'ad_title' => 'Ajouter un titre', @@ -344,7 +345,7 @@ return [ 'view' => 'Vue', 'ads_with_map' => 'Annonces avec carte', 'advanced_sorting' => 'Tri avancé', - 'filter_by_word' => 'Filter by word', + 'filter_by_word' => 'Filtrer par mot', 'free' => 'Gratuit', 'ad_date' => 'Date de l\'annonce', @@ -368,4 +369,5 @@ return [ 'old_price' => [ 'name' => 'Ancien prix' ], + 'save_search' => 'Sauvegarder la recherche', ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/fr/setting.php b/addons/default/visiosoft/advs-module/resources/lang/fr/setting.php index aef0c5408..8591da088 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/fr/setting.php +++ b/addons/default/visiosoft/advs-module/resources/lang/fr/setting.php @@ -264,5 +264,12 @@ return [ ], 'show_subcats_mobile' => [ 'name' => 'Afficher les sous-catégories sur la vue mobile', - ] + ], + 'show_price_to_members_only' => [ + 'name' => 'Afficher le prix aux membres seulement', + ], + 'hide_ad_cat' => [ + 'name' => 'Masquer les catégories', + 'instructions' => 'Masquer les catégories dans la liste des annonces' + ] ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/hu/field.php b/addons/default/visiosoft/advs-module/resources/lang/hu/field.php index 598d4dedb..9cb0e60d3 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/hu/field.php +++ b/addons/default/visiosoft/advs-module/resources/lang/hu/field.php @@ -336,6 +336,7 @@ return [ 'ad_location' => 'Hirdetés helye', 'owner' => 'Tulajdonos', 'default_owner_instruction' => 'A tulajdonos alapértelmezés szerint az aktuális felhasználót állítja be, ha nincs kiválasztva felhasználó', + 'create_page_subtitle' => 'Hozza létre a hirdetést hibátlanul a hirdetésével kapcsolatos részletes információk megadásával.', // Listing page 'ad_title' => 'Hirdetés címe', @@ -343,7 +344,7 @@ return [ 'view' => 'Kilátás', 'ads_with_map' => 'Hirdetések térképpel', 'advanced_sorting' => 'Haladó rendezés', - 'filter_by_word' => 'Filter by word', + 'filter_by_word' => 'Szűrés szó szerint', 'free' => 'Ingyenes', 'ad_date' => 'Hirdetés dátuma', @@ -367,4 +368,5 @@ return [ 'old_price' => [ 'name' => 'Régi ár' ], + 'save_search' => 'Keresés mentése', ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/hu/setting.php b/addons/default/visiosoft/advs-module/resources/lang/hu/setting.php index 10f9d11e7..002b500b7 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/hu/setting.php +++ b/addons/default/visiosoft/advs-module/resources/lang/hu/setting.php @@ -264,5 +264,12 @@ return [ ], 'show_subcats_mobile' => [ 'name' => 'Alkategóriák megjelenítése mobil nézetben', - ] + ], + 'show_price_to_members_only' => [ + 'name' => 'Árak megjelenítése csak tagoknak', + ], + 'hide_ad_cat' => [ + 'name' => 'Kategóriák elrejtése', + 'instructions' => 'Kategóriák elrejtése a hirdetési listában' + ] ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/tr/field.php b/addons/default/visiosoft/advs-module/resources/lang/tr/field.php index 39f6aabaf..66bf10dae 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/tr/field.php +++ b/addons/default/visiosoft/advs-module/resources/lang/tr/field.php @@ -338,6 +338,7 @@ return [ 'ad_location' => 'İlan Konumu', 'owner' => 'Sahip', 'default_owner_instruction' => 'Hiçbir kullanıcı seçilmezse, sahip varsayılan olarak mevcut kullanıcıyı kullanır', + 'create_page_subtitle' => 'Ürün veya ilan hakkında detaylı bilgi girebilirsiniz', // Listing page 'ad_title' => 'Başlık', @@ -369,4 +370,5 @@ return [ 'old_price' => [ 'name' => 'Eski fiyat' ], + 'save_search' => 'Aramayı Kaydet', ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/tr/setting.php b/addons/default/visiosoft/advs-module/resources/lang/tr/setting.php index 81f2aa961..94d4e460d 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/tr/setting.php +++ b/addons/default/visiosoft/advs-module/resources/lang/tr/setting.php @@ -264,5 +264,12 @@ return [ ], 'show_subcats_mobile' => [ 'name' => 'Alt kategorileri mobil görünümde göster', - ] + ], + 'show_price_to_members_only' => [ + 'name' => 'Sadece Üyelere Fiyat Göster', + ], + 'hide_ad_cat' => [ + 'name' => 'Kategorileri Gizle', + 'instructions' => 'İlan listelemede ilan kategorilerini gizle' + ] ]; diff --git a/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/detail.twig b/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/detail.twig index fd4d80c35..ab26ee08f 100644 --- a/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/detail.twig +++ b/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/detail.twig @@ -1,6 +1,5 @@
-
+
{% set standardPrice = adv.standard_price.value %} {% if standardPrice and standardPrice > 0 %}
diff --git a/addons/default/visiosoft/advs-module/resources/views/list/gallery.twig b/addons/default/visiosoft/advs-module/resources/views/list/gallery.twig index b40d8f829..1c1f67dce 100644 --- a/addons/default/visiosoft/advs-module/resources/views/list/gallery.twig +++ b/addons/default/visiosoft/advs-module/resources/views/list/gallery.twig @@ -28,7 +28,9 @@
{{ adv.name }}
-

{{ adv.cat1_name }} /{{ adv.cat2_name }}

+ {% if not setting_value('visiosoft.module.advs::hide_ad_cat') %} +

{{ adv.cat1_name }} /{{ adv.cat2_name }}

+ {% endif %} {% if showPrice %}

{{ adv.price != '0' ? currency_format(adv.price,adv.currency) : trans('visiosoft.module.advs::field.free') }} diff --git a/addons/default/visiosoft/advs-module/resources/views/list/list.twig b/addons/default/visiosoft/advs-module/resources/views/list/list.twig index 0128df3ef..9f2066468 100644 --- a/addons/default/visiosoft/advs-module/resources/views/list/list.twig +++ b/addons/default/visiosoft/advs-module/resources/views/list/list.twig @@ -27,7 +27,7 @@

- Save Search + {{ trans('visiosoft.module.advs::field.save_search') }} {{ img('visiosoft.module.advs::images/listing/save-search.svg').data|raw }}
diff --git a/addons/default/visiosoft/advs-module/resources/views/list/partials/ads.twig b/addons/default/visiosoft/advs-module/resources/views/list/partials/ads.twig index 77b6a1dc9..bda048385 100644 --- a/addons/default/visiosoft/advs-module/resources/views/list/partials/ads.twig +++ b/addons/default/visiosoft/advs-module/resources/views/list/partials/ads.twig @@ -35,7 +35,9 @@
{{ adv.name }}
-

{{ adv.cat1_name }} /{{ adv.cat2_name }}

+ {% if not setting_value('visiosoft.module.advs::hide_ad_cat') %} +

{{ adv.cat1_name }} /{{ adv.cat2_name }}

+ {% endif %}
{{ addBlock('list/extra-actions', {'ad': adv, 'vars': _context})|raw }} diff --git a/addons/default/visiosoft/advs-module/resources/views/list/partials/list-filter.twig b/addons/default/visiosoft/advs-module/resources/views/list/partials/list-filter.twig index 045c61bfa..9323ec8b7 100644 --- a/addons/default/visiosoft/advs-module/resources/views/list/partials/list-filter.twig +++ b/addons/default/visiosoft/advs-module/resources/views/list/partials/list-filter.twig @@ -14,11 +14,13 @@ {{ img('visiosoft.module.advs::images/listing/list.svg').data|raw }}

{{ trans("visiosoft.module.advs::field.list") }}

- - {{ img('visiosoft.module.advs::images/listing/map.svg').data|raw }} -

{{ trans("visiosoft.module.advs::field.map.name") }}

-
+ {% if setting_value('visiosoft.module.location::list_page_location') %} + + {{ img('visiosoft.module.advs::images/listing/map.svg').data|raw }} +

{{ trans("visiosoft.module.advs::field.map.name") }}

+
+ {% endif %}
{% include 'visiosoft.module.cats::ads-list/partials/cat-filter' %} diff --git a/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig b/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig index d203ab172..ae4e1403f 100644 --- a/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig +++ b/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig @@ -1,7 +1,18 @@ {% extends layout('new-create') %} +{% block styles %} + + + + +{% endblock %} + {% block content %}
+ {% include 'visiosoft.module.advs::new-ad/partials/steps' with {'step': 'new-create'} %}
@@ -17,6 +28,12 @@ + +
+

{{ trans('visiosoft.module.advs::field.listing_details') }}

+

{{ trans('visiosoft.module.advs::field.create_page_subtitle') }}

+
+
@@ -48,125 +65,107 @@ {% include 'visiosoft.module.advs::new-ad/partials/contact-info' %} -
{{ trans('visiosoft.module.advs::field.ad_info') }}
-
-
- {% set fields = form.fields.base().pluck('field_name').all() %} -
-
- {% for field in form.fields.translations('name') %} - {{ field.render({'form': form})|raw }} - {% endfor %} -
-
+
+

{{ trans('visiosoft.module.advs::field.ad_info') }}

-
- {{ form.fields.slug|raw }} -
-
+ {% if setting_value('visiosoft.module.advs::market_place') %} {{ addBlock('new-ad/fields', {'adv': adv})|raw }} {% endif %} -
- -
- {{ form.fields.standard_price.setAttributes({ - 'required' :true - }).input|raw }} -
- {% set standardPriceValue = form.fields.standard_price.value|split('.') %} -
- -
-
- -
-
-
+
+
+ - -
- {{ form.fields.price.setAttributes({ - 'required' :true - }).input|raw }} -
- {% set PriceValue = form.fields.price.value|split('.') %} -
- -
- {% if setting_value('visiosoft.field_type.decimal::showDecimal') %} -
- +
+ {{ form.fields.price.setAttributes({ + 'required' :true + }).input|raw }}
- {% endif %} -
- +
+ {% set PriceValue = form.fields.price.value|split('.') %} + + {% if setting_value('visiosoft.field_type.decimal::showDecimal') %} + + {% endif %} +
+
+
+ + +
+ {{ form.fields.standard_price.setAttributes({ + 'required' :true + }).input|raw }} +
+ +
+ {% set standardPriceValue = form.fields.standard_price.value|split('.') %} + + {% if setting_value('visiosoft.field_type.decimal::showDecimal') %} + + {% endif %} + +
{% if not setting_value('visiosoft.module.advs::hide_options_field') %} {% if not setting_value('visiosoft.module.advs::detailed_product_options') %} -
-
\n ")},choiceGroup:function(e){var i=(0,u.default)(t.group,s({},t.itemDisabled,e.disabled));return(0,v.strToEl)('\n \n
'+e.value+"
\n
\n ")},choice:function(i){var n,o=(0,u.default)(t.item,t.itemChoice,(n={},s(n,t.itemDisabled,i.disabled),s(n,t.itemSelectable,!i.disabled),s(n,t.placeholder,i.placeholder),n));return(0,v.strToEl)('\n 0?'role="treeitem"':'role="option"')+"\n >\n "+i.label+"\n
\n ")},input:function(){var e=(0,u.default)(t.input,t.inputCloned);return(0,v.strToEl)('\n \n ')},dropdown:function(){var e=(0,u.default)(t.list,t.listDropdown);return(0,v.strToEl)('\n
\n ')},notice:function(e){var i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",o=(0,u.default)(t.item,t.itemChoice,(i={},s(i,t.noResults,"no-results"===n),s(i,t.noChoices,"no-choices"===n),i));return(0,v.strToEl)('\n
\n '+e+"\n
\n ")},option:function(e){return(0,v.strToEl)('\n \n ")}},n=this.config.callbackOnCreateTemplates,o={};n&&(0,v.isType)("Function",n)&&(o=n.call(this,v.strToEl)),this.config.templates=(0,v.extend)(i,o)}},{key:"_setLoading",value:function(e){this.store.dispatch((0,p.setIsLoading)(e))}},{key:"_createInput",value:function(){var e=this,t=this.passedElement.getAttribute("dir")||"ltr",i=this._getTemplate("containerOuter",t),n=this._getTemplate("containerInner"),s=this._getTemplate("itemList"),o=this._getTemplate("choiceList"),r=this._getTemplate("input"),a=this._getTemplate("dropdown");this.containerOuter=i,this.containerInner=n,this.input=r,this.choiceList=o,this.itemList=s,this.dropdown=a,this.passedElement.classList.add(this.config.classNames.input,this.config.classNames.hiddenState),this.passedElement.tabIndex="-1";var c=this.passedElement.getAttribute("style");if(Boolean(c)&&this.passedElement.setAttribute("data-choice-orig-style",c),this.passedElement.setAttribute("style","display:none;"),this.passedElement.setAttribute("aria-hidden","true"),this.passedElement.setAttribute("data-choice","active"),(0,v.wrap)(this.passedElement,n),(0,v.wrap)(n,i),this.isSelectOneElement?r.placeholder=this.config.searchPlaceholderValue||"":this.placeholder&&(r.placeholder=this.placeholder,r.style.width=(0,v.getWidthOfInput)(r)),this.config.addItems||this.disable(),i.appendChild(n),i.appendChild(a),n.appendChild(s),this.isTextElement||a.appendChild(o),this.isSelectMultipleElement||this.isTextElement?n.appendChild(r):this.canSearch&&a.insertBefore(r,a.firstChild),this.isSelectElement){var l=Array.from(this.passedElement.getElementsByTagName("OPTGROUP"));if(this.highlightPosition=0,this.isSearching=!1,this._setLoading(!0),l&&l.length)l.forEach(function(t){e._addGroup(t,t.id||null)});else{var h=Array.from(this.passedElement.options),u=this.config.sortFilter,d=this.presetChoices;h.forEach(function(e){d.push({value:e.value,label:e.innerHTML,selected:e.selected,disabled:e.disabled||e.parentNode.disabled,placeholder:e.hasAttribute("placeholder")})}),this.config.shouldSort&&d.sort(u);var f=d.some(function(e){return e.selected});d.forEach(function(t,i){if(e.isSelectOneElement){var n=f||!f&&i>0;e._addChoice(t.value,t.label,!n||t.selected,!!n&&t.disabled,void 0,t.customProperties,t.placeholder)}else e._addChoice(t.value,t.label,t.selected,t.disabled,void 0,t.customProperties,t.placeholder)})}this._setLoading(!1)}else this.isTextElement&&this.presetItems.forEach(function(t){var i=(0,v.getType)(t);if("Object"===i){if(!t.value)return;e._addItem(t.value,t.label,t.id,void 0,t.customProperties,t.placeholder)}else"String"===i&&e._addItem(t)})}}]),e}();e.exports=m},function(e,t,i){!function(t){"use strict";function i(){console.log.apply(console,arguments)}function n(e,t){var i;this.list=e,this.options=t=t||{};for(i in a)a.hasOwnProperty(i)&&("boolean"==typeof a[i]?this.options[i]=i in t?t[i]:a[i]:this.options[i]=t[i]||a[i])}function s(e,t,i){var n,r,a,c,l,h;if(t){if(a=t.indexOf("."),a!==-1?(n=t.slice(0,a),r=t.slice(a+1)):n=t,c=e[n],null!==c&&void 0!==c)if(r||"string"!=typeof c&&"number"!=typeof c)if(o(c))for(l=0,h=c.length;l1)throw new Error("Key weight has to be > 0 and <= 1");e=e.name}else this._keyMap[e]={weight:1};this._analyze(e,o(h,e,[]),h,i)}},n.prototype._analyze=function(e,t,n,s){var r,a,c,l,h,u,d,f,p,v,m,g,y,b,E,_=this.options,S=!1;if(void 0!==t&&null!==t){a=[];var I=0;if("string"==typeof t){if(r=t.split(_.tokenSeparator),_.verbose&&i("---------\nKey:",e),this.options.tokenize){for(b=0;b=this.tokenSearchers.length,_.verbose&&i("Check Matches",y),(S||d.isMatch)&&y&&(c=this.resultMap[s],c?c.output.push({key:e,score:h,matchedIndices:d.matchedIndices}):(this.resultMap[s]={item:n,output:[{key:e,score:h,matchedIndices:d.matchedIndices}]},this.results.push(this.resultMap[s])))}else if(o(t))for(b=0;b0){if(t={item:r.item},l.indexOf("matches")!==-1)for(n=r.output,t.matches=[],i=0;iw.maxPatternLength){if(y=e.match(new RegExp(this.pattern.replace(w.tokenSeparator,"|"))),b=!!y)for(_=[],t=0,S=y.length;t=u;i--)if(v=this.patternAlphabet[e.charAt(i-1)],v&&(E[i-1]=1),f[i]=(f[i+1]<<1|1)&v,0!==t&&(f[i]|=(p[i+1]|p[i])<<1|1|p[i+1]),f[i]&this.matchmask&&(m=this._bitapScore(t,i-1),m<=r)){if(r=m,a=i-1,g.push(a),a<=o)break;u=Math.max(1,2*o-a)}if(this._bitapScore(t+1,o)>r)break;p=f}return _=this._getMatchedIndices(E),{isMatch:a>=0,score:0===m?.001:m,matchedIndices:_}},r.prototype._getMatchedIndices=function(e){for(var t,i=[],n=-1,s=-1,o=0,r=e.length;o=this.options.minMatchCharLength&&i.push([n,s]),n=-1);return e[o-1]&&o-1-n+1>=this.options.minMatchCharLength&&i.push([n,o-1]),i},e.exports=n}(this)},function(e,t,i){var n,s;!function(){"use strict";function i(){for(var e=[],t=0;t0&&void 0!==arguments[0]?arguments[0]:this.getItems(),t=e.reduce(function(e,t){return e.push(t.value),e},[]);return t}},{key:"getChoices",value:function(){var e=this.store.getState();return e.choices}},{key:"getChoicesFilteredByActive",value:function(){var e=this.getChoices(),t=e.filter(function(e){return e.active===!0});return t}},{key:"getChoicesFilteredBySelectable",value:function(){var e=this.getChoices(),t=e.filter(function(e){return e.disabled!==!0});return t}},{key:"getSearchableChoices",value:function(){var e=this.getChoicesFilteredBySelectable();return e.filter(function(e){return e.placeholder!==!0})}},{key:"getChoiceById",value:function(e){if(e){var t=this.getChoicesFilteredByActive(),i=t.find(function(t){return t.id===parseInt(e,10)});return i}return!1}},{key:"getGroups",value:function(){var e=this.store.getState();return e.groups}},{key:"getGroupsFilteredByActive",value:function(){var e=this.getGroups(),t=this.getChoices(),i=e.filter(function(e){var i=e.active===!0&&e.disabled===!1,n=t.some(function(e){return e.active===!0&&e.disabled===!1});return i&&n},[]);return i}},{key:"getGroupById",value:function(e){var t=this.getGroups(),i=t.find(function(t){return t.id===e});return i}},{key:"getPlaceholderChoice",value:function(){var e=this.getChoices(),t=[].concat(s(e)).reverse().find(function(e){return e.placeholder===!0});return t}}]),e}();t.default=h,e.exports=h},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.compose=t.applyMiddleware=t.bindActionCreators=t.combineReducers=t.createStore=void 0;var s=i(6),o=n(s),r=i(21),a=n(r),c=i(23),l=n(c),h=i(24),u=n(h),d=i(25),f=n(d),p=i(22);n(p);t.createStore=o.default,t.combineReducers=a.default,t.bindActionCreators=l.default,t.applyMiddleware=u.default,t.compose=f.default},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function s(e,t,i){function n(){g===m&&(g=m.slice())}function o(){return v}function a(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return n(),g.push(e),function(){if(t){t=!1,n();var i=g.indexOf(e);g.splice(i,1)}}}function h(e){if(!(0,r.default)(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if("undefined"==typeof e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(y)throw new Error("Reducers may not dispatch actions.");try{y=!0,v=p(v,e)}finally{y=!1}for(var t=m=g,i=0;i0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(c)throw c;for(var n=!1,o={},r=0;r0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];switch(t.type){case"ADD_ITEM":var n=[].concat(i(e),[{id:t.id,choiceId:t.choiceId,groupId:t.groupId,value:t.value,label:t.label,active:!0,highlighted:!1,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]);return n.map(function(e){return e.highlighted&&(e.highlighted=!1),e});case"REMOVE_ITEM":return e.map(function(e){return e.id===t.id&&(e.active=!1),e});case"HIGHLIGHT_ITEM":return e.map(function(e){return e.id===t.id&&(e.highlighted=t.highlighted),e});default:return e}};t.default=n},function(e,t){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];switch(t.type){case"ADD_GROUP":return[].concat(i(e),[{id:t.id,value:t.value,active:t.active,disabled:t.disabled}]);case"CLEAR_CHOICES":return e.groups=[];default:return e}};t.default=n},function(e,t){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];switch(t.type){case"ADD_CHOICE":return[].concat(i(e),[{id:t.id,elementId:t.elementId,groupId:t.groupId,value:t.value,label:t.label||t.value,disabled:t.disabled||!1,selected:!1,active:!0,score:9999,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]);case"ADD_ITEM":var n=e;return t.activateOptions&&(n=e.map(function(e){return e.active=t.active,e})),t.choiceId>-1&&(n=e.map(function(e){return e.id===parseInt(t.choiceId,10)&&(e.selected=!0),e})),n;case"REMOVE_ITEM":return t.choiceId>-1?e.map(function(e){return e.id===parseInt(t.choiceId,10)&&(e.selected=!1),e}):e;case"FILTER_CHOICES":var s=t.results,o=e.map(function(e){return e.active=s.some(function(t){return t.item.id===e.id&&(e.score=t.score,!0)}),e});return o;case"ACTIVATE_CHOICES":return e.map(function(e){return e.active=t.active,e});case"CLEAR_CHOICES":return e.choices=[];default:return e}};t.default=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{loading:!1},t=arguments[1];switch(t.type){case"LOADING":return{loading:t.isLoading};default:return e}};t.default=i},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.addItem=function(e,t,i,n,s,o,r,a){return{type:"ADD_ITEM",value:e,label:t,id:i,choiceId:n,groupId:s,customProperties:o,placeholder:r,keyCode:a}},t.removeItem=function(e,t){return{type:"REMOVE_ITEM",id:e,choiceId:t}},t.highlightItem=function(e,t){return{type:"HIGHLIGHT_ITEM",id:e,highlighted:t}},t.addChoice=function(e,t,i,n,s,o,r,a,c){return{type:"ADD_CHOICE",value:e,label:t,id:i,groupId:n,disabled:s,elementId:o,customProperties:r,placeholder:a,keyCode:c}},t.filterChoices=function(e){return{type:"FILTER_CHOICES",results:e}},t.activateChoices=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return{type:"ACTIVATE_CHOICES",active:e}},t.clearChoices=function(){return{type:"CLEAR_CHOICES"}},t.addGroup=function(e,t,i,n){return{type:"ADD_GROUP",value:e,id:t,active:i,disabled:n}},t.clearAll=function(){return{type:"CLEAR_ALL"}},t.setIsLoading=function(e){return{type:"LOADING",isLoading:e}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=(t.capitalise=function(e){return e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})},t.generateChars=function(e){for(var t="",i=0;i=0?t:0},t.getElementOffset=function(e,t){var i=t;return i>1&&(i=1),i>0&&(i=0),Math.max(e.offsetHeight*i)},t.getAdjacentEl=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e&&t){var n=e.parentNode.parentNode,s=Array.from(n.querySelectorAll(t)),o=s.indexOf(e),r=i>0?1:-1;return s[o+r]}},t.getScrollPosition=function(e){return"bottom"===e?Math.max((window.scrollY||window.pageYOffset)+(window.innerHeight||document.documentElement.clientHeight)):window.scrollY||window.pageYOffset},t.isInView=function(e,t,i){return this.getScrollPosition(t)>this.getElemDistance(e)+this.getElementOffset(e,i)},t.isScrolledIntoView=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e){var n=void 0;return n=i>0?t.scrollTop+t.offsetHeight>=e.offsetTop+e.offsetHeight:e.offsetTop>=t.scrollTop}},t.stripHTML=function(e){return e.replace(/&/g,"&").replace(/>/g,"&rt;").replace(/"+a(t)+"");if(n.style.position="absolute",n.style.padding="0",n.style.top="-9999px",n.style.left="-9999px",n.style.width="auto",n.style.whiteSpace="pre",document.body.contains(e)&&window.getComputedStyle){var s=window.getComputedStyle(e);s&&(n.style.fontSize=s.fontSize,n.style.fontFamily=s.fontFamily,n.style.fontWeight=s.fontWeight,n.style.fontStyle=s.fontStyle,n.style.letterSpacing=s.letterSpacing,n.style.textTransform=s.textTransform,n.style.padding=s.padding)}document.body.appendChild(n),t&&n.offsetWidth!==e.offsetWidth&&(i=n.offsetWidth+4),document.body.removeChild(n)}return i+"px"},t.sortByAlpha=function(e,t){var i=(e.label||e.value).toLowerCase(),n=(t.label||t.value).toLowerCase();return in?1:0},t.sortByScore=function(e,t){return e.score-t.score},t.triggerEvent=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0});return e.dispatchEvent(n)}},function(e,t){"use strict";!function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i}Array.from||(Array.from=function(){var e=Object.prototype.toString,t=function(t){return"function"==typeof t||"[object Function]"===e.call(t)},i=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t},n=Math.pow(2,53)-1,s=function(e){var t=i(e);return Math.min(Math.max(t,0),n)};return function(e){var i=this,n=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var o,r=arguments.length>1?arguments[1]:void 0;if("undefined"!=typeof r){if(!t(r))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(o=arguments[2])}for(var a,c=s(n.length),l=t(i)?Object(new i(c)):new Array(c),h=0;h>>0,s=arguments[1],o=0;o tbody', + containerSelector: 'table', + placeholder: '', + afterMove: function ($placeholder) { + + $placeholder.closest('table').find('button.reorder').removeClass('disabled'); + + $placeholder.closest('table').find('.dragged').detach().insertBefore($placeholder); + + selected = []; + + $(wrapper.find('table').find('[data-dismiss="multiple"]')).each(function () { + selected.push(String($(this).data('entry'))); + }); + + $('[name="' + field + '"]').val(selected.join(',')); + } + }); + } + + // Sort initially + wrapper.sort(); + }); +}); diff --git a/addons/default/visiosoft/multiple-field_type/resources/js/tags.js b/addons/default/visiosoft/multiple-field_type/resources/js/tags.js new file mode 100644 index 000000000..527498a4a --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/js/tags.js @@ -0,0 +1,13 @@ +(function (window, document) { + + let fields = Array.prototype.slice.call( + document.querySelectorAll('select[data-provides="visiosoft.field_type.multiple"]') + ); + + fields.forEach(function (field) { + new Choices(field, { + removeItemButton: true, + searchResultLimit: 10, + }); + }); +})(window, document); diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/ar/addon.php b/addons/default/visiosoft/multiple-field_type/resources/lang/ar/addon.php new file mode 100644 index 000000000..54ae3ab70 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/ar/addon.php @@ -0,0 +1,7 @@ + 'متعدد', + 'name' => 'نوع الحقل المتعدد', + 'description' => 'نوع الحقل النتعدد العلاقات.', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/ar/config.php b/addons/default/visiosoft/multiple-field_type/resources/lang/ar/config.php new file mode 100644 index 000000000..b691b27ab --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/ar/config.php @@ -0,0 +1,29 @@ + [ + 'label' => 'الدفق المرتبط', + 'instructions' => 'حدد إدخالات الدفق ذات الصلة لعرضها ضمن القائمة المنسدلة.', + ], + 'mode' => [ + 'label' => 'وضخ الإدخال', + 'option' => [ + 'tags' => 'الأوسمة', + 'lookup' => 'ابحث عن', + 'checkboxes' => 'مربعات الاختيار', + ], + ], + 'min' => [ + 'label' => 'الحد الأدنى للاختيارات', + 'instructions' => 'حدد الحد الأدني للاختيارات المسموحة.', + ], + 'max' => [ + 'label' => 'الحد الأعلى للاختيارات', + 'instructions' => 'حدد عدد الحد الأعلى اللاختيارات المسموحة.', + ], + 'title_name' => [ + 'label' => 'حقل العنوان', + 'placeholder' => 'الاسم الأول', + 'instructions' => 'حدد slug لعرضه لخيارات القائمة المنسدلة / البحث.
يمكنك تحديد عناوين قابلة للتحليل مثل {entry.first_name} {entry.last_name}
سيتم استخدام عمود عنوان التدفق ذي الصلة افتراضيًا.', + ], +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/ar/input.php b/addons/default/visiosoft/multiple-field_type/resources/lang/ar/input.php new file mode 100644 index 000000000..d8e14ecb9 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/ar/input.php @@ -0,0 +1,6 @@ + 'اختر خيار...', + 'help' => 'اختر القيم بحيث يكون بينها فاصلة , ثم اضغط "ادخال".', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/ar/message.php b/addons/default/visiosoft/multiple-field_type/resources/lang/ar/message.php new file mode 100644 index 000000000..321b9adbe --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/ar/message.php @@ -0,0 +1,5 @@ + 'حدد الإدخالات التي تريد اضافتها.', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/de/addon.php b/addons/default/visiosoft/multiple-field_type/resources/lang/de/addon.php new file mode 100644 index 000000000..6918c0a47 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/de/addon.php @@ -0,0 +1,7 @@ + 'Mehrfachbeziehungen', + 'name' => 'Mehrfachbeziehungen Feldtyp', + 'description' => 'Ein Feldtyp für Mehrfachbeziehungen.', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/de/config.php b/addons/default/visiosoft/multiple-field_type/resources/lang/de/config.php new file mode 100644 index 000000000..f43d0f644 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/de/config.php @@ -0,0 +1,29 @@ + [ + 'label' => 'Verbundener Stream', + 'instructions' => 'Geben Sie den verbunden Stream an, dessen Einträge im Dropdown zur Auswahl stehen sollen.', + ], + 'mode' => [ + 'label' => 'Eingabemodus', + 'option' => [ + 'tags' => 'Stichworte', + 'lookup' => 'Nachschlagen', + 'checkboxes' => 'Kontrollkästchen', + ], + ], + 'min' => [ + 'label' => 'Minimalauswahl', + 'instructions' => 'Geben Sie die minimale Anzahl an auszuwählenden Einträgen ein.', + ], + 'max' => [ + 'label' => 'Maximalauswahl', + 'instructions' => 'Geben Sie die maximal erlaubte Anzahl an ausgewählten Einträgen an.', + ], + 'title_name' => [ + 'label' => 'Titelfeld', + 'placeholder' => 'Vorname', + 'instructions' => 'Geben Sie den Slug des Felds an, das für Dropdown- / Suchoptionen angezeigt werden soll.
Sie können analysierbare Titel wie {entry.first_name} {entry.last_name}
angeben. Die Titelspalte des zugehörigen Streams wird standardmäßig verwendet.', + ], +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/de/input.php b/addons/default/visiosoft/multiple-field_type/resources/lang/de/input.php new file mode 100644 index 000000000..08227fc10 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/de/input.php @@ -0,0 +1,6 @@ + 'Wählen Sie eine Option...', + 'help' => 'Trennen Sie Ihre Eingaben mit einem Komma oder durch drücken der Taste Enter.', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/de/message.php b/addons/default/visiosoft/multiple-field_type/resources/lang/de/message.php new file mode 100644 index 000000000..e16d9bb4b --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/de/message.php @@ -0,0 +1,5 @@ + 'Wählen Sie die Einträge aus, die Sie hinzufügen möchten.', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/en/addon.php b/addons/default/visiosoft/multiple-field_type/resources/lang/en/addon.php new file mode 100644 index 000000000..b58237ed9 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/en/addon.php @@ -0,0 +1,7 @@ + 'Multiple', + 'name' => 'Multiple Field Type', + 'description' => 'A multiple relationship field type.', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/en/config.php b/addons/default/visiosoft/multiple-field_type/resources/lang/en/config.php new file mode 100644 index 000000000..ab3401aa7 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/en/config.php @@ -0,0 +1,29 @@ + [ + 'label' => 'Related Stream', + 'instructions' => 'Specify the related stream entries to display in the dropdown.', + ], + 'mode' => [ + 'label' => 'Input Mode', + 'option' => [ + 'tags' => 'Tags', + 'lookup' => 'Lookup', + 'checkboxes' => 'Checkboxes', + ], + ], + 'min' => [ + 'label' => 'Minimum Selections', + 'instructions' => 'Specify the minimum number of allowed selections.', + ], + 'max' => [ + 'label' => 'Maximum Selections', + 'instructions' => 'Specify the maximum number of allowed selections.', + ], + 'title_name' => [ + 'label' => 'Title Field', + 'placeholder' => 'first_name', + 'instructions' => 'Specify the slug of field to display for dropdown/search options.
You can specify parsable titles like {entry.first_name} {entry.last_name}
The related stream\'s title column will be used by default.', + ], +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/en/input.php b/addons/default/visiosoft/multiple-field_type/resources/lang/en/input.php new file mode 100644 index 000000000..eb1c1d223 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/en/input.php @@ -0,0 +1,6 @@ + 'Choose an option...', + 'help' => 'Separate values with a comma or by pressing "Enter".', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/en/message.php b/addons/default/visiosoft/multiple-field_type/resources/lang/en/message.php new file mode 100644 index 000000000..212311d7a --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/en/message.php @@ -0,0 +1,5 @@ + 'Select the entries you would like to add.', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/fr/addon.php b/addons/default/visiosoft/multiple-field_type/resources/lang/fr/addon.php new file mode 100644 index 000000000..b957ab83c --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/fr/addon.php @@ -0,0 +1,7 @@ + 'Plusieurs', + 'name' => 'Multiple', + 'description' => 'Type de champs pour les relations multiples.', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/fr/config.php b/addons/default/visiosoft/multiple-field_type/resources/lang/fr/config.php new file mode 100644 index 000000000..19ebe2f16 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/fr/config.php @@ -0,0 +1,29 @@ + [ + 'label' => 'Stream en relation', + 'instructions' => 'Choisissez les entrées à afficher dans la sélection.', + ], + 'mode' => [ + 'label' => 'Mode d\'entrée', + 'option' => [ + 'tags' => 'Mots clés', + 'lookup' => 'Chercher', + 'checkboxes' => 'Cases à cocher', + ], + ], + 'min' => [ + 'label' => 'Nombre de sélection minimum', + 'instructions' => 'Entrez un nombre minimum de sélection.', + ], + 'max' => [ + 'label' => 'Nombre de sélection maximum', + 'instructions' => 'Entrez un nombre maximum de sélection.', + ], + 'title_name' => [ + 'label' => 'Champ de titre', + 'placeholder' => 'Prénom', + 'instructions' => 'Spécifiez le slug du champ à afficher pour les options de liste déroulante / de recherche.
Vous pouvez spécifier des titres analysables tels que {entry.first_name} {entry.last_name}
La colonne de titre du flux associé sera utilisée par défaut.', + ], +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/fr/input.php b/addons/default/visiosoft/multiple-field_type/resources/lang/fr/input.php new file mode 100644 index 000000000..11673965e --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/fr/input.php @@ -0,0 +1,6 @@ + 'Choisissez une option...', + 'help' => 'Séparez les valeurs par une virgule ou en tapant "Entrée".', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/fr/message.php b/addons/default/visiosoft/multiple-field_type/resources/lang/fr/message.php new file mode 100644 index 000000000..98d1f8141 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/fr/message.php @@ -0,0 +1,5 @@ + 'Sélectionnez les entrées que vous souhaitez ajouter.', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/hu/addon.php b/addons/default/visiosoft/multiple-field_type/resources/lang/hu/addon.php new file mode 100644 index 000000000..815f0dd73 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/hu/addon.php @@ -0,0 +1,7 @@ + 'Többszörös', + 'name' => 'Többszörös Mező Típus', + 'description' => 'Többszörös kapcsolat mező típus.', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/hu/config.php b/addons/default/visiosoft/multiple-field_type/resources/lang/hu/config.php new file mode 100644 index 000000000..1e58e3274 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/hu/config.php @@ -0,0 +1,29 @@ + [ + 'label' => 'Releváns Folyam', + 'instructions' => 'Határozd meg a releváns folyamat a legördülő megjelenítéséhez.', + ], + 'mode' => [ + 'label' => 'Bevitel Módja', + 'option' => [ + 'tags' => 'Cimkék', + 'lookup' => 'Átvizsgálás', + 'checkboxes' => 'Jelölőnégyzetek', + ], + ], + 'min' => [ + 'label' => 'Minimális Kiválasztás', + 'instructions' => 'Határozd meg a minimálisan kiválasztható elemek számát.', + ], + 'max' => [ + 'label' => 'Maximális Kiválasztás', + 'instructions' => 'Határozd meg a maximálisan kiválasztható elemek számát.', + ], + 'title_name' => [ + 'label' => 'Cím mező', + 'placeholder' => 'keresztnév', + 'instructions' => 'Adja meg a mezõjét a megjelenítendõ legördülõ / keresési opciókhoz.
Megadhat értelmezhető címeket, például {entry.first_name} {entry.last_name}
Alapértelmezés szerint a kapcsolódó adatfolyam oszlopát fogja használni.', + ], +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/hu/input.php b/addons/default/visiosoft/multiple-field_type/resources/lang/hu/input.php new file mode 100644 index 000000000..a1a8b2e0d --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/hu/input.php @@ -0,0 +1,6 @@ + 'Válassz elemet...', + 'help' => 'Az értékeket szóközzel, vagy enterrel válaszd el.', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/hu/message.php b/addons/default/visiosoft/multiple-field_type/resources/lang/hu/message.php new file mode 100644 index 000000000..67f1f9d09 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/hu/message.php @@ -0,0 +1,5 @@ + 'Válaszd ki a bejegyzéseket amiket hozzá szeretnél adni.', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/tr/addon.php b/addons/default/visiosoft/multiple-field_type/resources/lang/tr/addon.php new file mode 100644 index 000000000..da60b0edb --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/tr/addon.php @@ -0,0 +1,7 @@ + 'Çoklu', + 'name' => 'Çoklu Alan Tipi', + 'description' => 'Bir çoklu ilişki alan tipi', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/tr/config.php b/addons/default/visiosoft/multiple-field_type/resources/lang/tr/config.php new file mode 100644 index 000000000..ad555c66d --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/tr/config.php @@ -0,0 +1,29 @@ + [ + 'label' => 'İlişkili Stream', + 'instructions' => 'Açılırlistede gösterilecek ilişkili stream girişlerini belirtin.', + ], + 'mode' => [ + 'label' => 'Giriş Modu', + 'option' => [ + 'tags' => 'Etiketler', + 'lookup' => 'Bakış', + 'checkboxes' => 'Onay Kutuları', + ], + ], + 'min' => [ + 'label' => 'Minimum seçim sayısı', + 'instructions' => 'İzin verilen minimum seçim sayısını belirtin.', + ], + 'max' => [ + 'label' => 'Maksimum seçim sayısı', + 'instructions' => 'İzin verilen maksimum seçim sayısını belirtin.', + ], + 'title_name' => [ + 'label' => 'Başlık Alanı', + 'placeholder' => 'İsim', + 'instructions' => 'Açılır menü / arama seçeneklerini görüntülemek için alanın slug değerini belirtin.
{entry.first_name} {entry.last_name}
gibi sütun isimleri belirtebilirsiniz.', + ], +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/tr/input.php b/addons/default/visiosoft/multiple-field_type/resources/lang/tr/input.php new file mode 100644 index 000000000..4b9639bdb --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/tr/input.php @@ -0,0 +1,6 @@ + 'Bir seçim yapın...', + 'help' => 'Girişleri, arasına virgül koyarak veya "Enter" tuşuna basarak ayırabilirsiniz.', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/tr/message.php b/addons/default/visiosoft/multiple-field_type/resources/lang/tr/message.php new file mode 100644 index 000000000..4893f6a93 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/tr/message.php @@ -0,0 +1,5 @@ + 'Eklemek istediğiniz girişleri seçin.', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/addon.php b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/addon.php new file mode 100644 index 000000000..1dbf45af0 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/addon.php @@ -0,0 +1,7 @@ + '多个', + 'name' => '多个字段类型', + 'description' => '一个多个关系字段类型。', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/config.php b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/config.php new file mode 100644 index 000000000..f3dcb44d4 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/config.php @@ -0,0 +1,23 @@ + [ + 'label' => '关系表', + 'instructions' => '指定在下拉框中数据所属的关系表。', + ], + 'mode' => [ + 'label' => '输入类型', + 'option' => [ + 'tags' => '标签', + 'lookup' => '查找', + ], + ], + 'min' => [ + 'label' => '最少选项数', + 'instructions' => '指定允许最小的选项数量。', + ], + 'max' => [ + 'label' => '最多选项数', + 'instructions' => '指定允许最多的选项数量。', + ], +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/input.php b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/input.php new file mode 100644 index 000000000..fdfa5db68 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/input.php @@ -0,0 +1,6 @@ + '请选择一个选项', + 'help' => '请使用逗号或者回车键来分开不同选项。', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/message.php b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/message.php new file mode 100644 index 000000000..431e79ab7 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/message.php @@ -0,0 +1,5 @@ + '选择你想添加的具体实例。', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/addon.php b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/addon.php new file mode 100644 index 000000000..689eefe6d --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/addon.php @@ -0,0 +1,7 @@ + '多重', + 'name' => '多重欄位型別', + 'description' => '一個具有多重關係的欄位型別。', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/config.php b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/config.php new file mode 100644 index 000000000..eecff34cc --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/config.php @@ -0,0 +1,23 @@ + [ + 'label' => '關連的資料流', + 'instructions' => '指定在下拉選單中資料所屬的資料流。', + ], + 'mode' => [ + 'label' => '輸入模式', + 'option' => [ + 'tags' => '標籤', + 'lookup' => '查找', + ], + ], + 'min' => [ + 'label' => '最小選項數量', + 'instructions' => '指定允許的最小選項數量。', + ], + 'max' => [ + 'label' => '最大選項數量', + 'instructions' => '指定允許的最大選項數量。', + ], +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/input.php b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/input.php new file mode 100644 index 000000000..242ab513a --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/input.php @@ -0,0 +1,6 @@ + '請選擇一個項目...', + 'help' => '請使用英文逗號或換行來區別不同的項目。', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/message.php b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/message.php new file mode 100644 index 000000000..747dd5ca1 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/message.php @@ -0,0 +1,5 @@ + '選擇您想新增的項目。', +]; diff --git a/addons/default/visiosoft/multiple-field_type/resources/scss/choices.scss b/addons/default/visiosoft/multiple-field_type/resources/scss/choices.scss new file mode 100644 index 000000000..85861b571 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/scss/choices.scss @@ -0,0 +1,340 @@ +/*=============================== += Choices = +===============================*/ + +$choices-selector: 'choices' !default; +$choices-font-size-lg: 16px !default; +$choices-font-size-md: 14px !default; +$choices-font-size-sm: 12px !default; +$choices-guttering: 0.5rem !default; +$choices-border-radius: .1rem !default; +$choices-border-radius-item: .1rem !default; +$choices-bg-color: #ffffff !default; +$choices-bg-color-disabled: #eceeef !default; +$choices-bg-color-dropdown: #FFFFFF !default; +$choices-text-color: #55595c !default; +$choices-keyline-color: #DDDDDD !default; +$choices-primary-color: #11bef6 !default; +$choices-disabled-color: #eaeaea !default; +$choices-highlight-color: $choices-primary-color !default; +$choices-button-icon-path: '../../icons' !default; +$choices-button-dimension: 8px !default; +$choices-button-offset: 8px !default; + +.#{$choices-selector} { + position: relative; + margin-bottom: $choices-guttering; + font-size: $choices-font-size-lg; + &:focus { + outline: none; + } + &:last-child { + margin-bottom: 0; + } + &.is-disabled { + .#{$choices-selector}__inner, .#{$choices-selector}__input { + background-color: $choices-bg-color-disabled; + cursor: not-allowed; + user-select: none; + } + .#{$choices-selector}__item { + cursor: not-allowed; + } + } +} + +.#{$choices-selector}[data-type*="select-one"] { + cursor: pointer; + .#{$choices-selector}__inner { + padding-bottom: 7.5px; + } + .#{$choices-selector}__input { + display: block; + width: 100%; + padding: 10px; + border-bottom: 1px solid $choices-keyline-color; + background-color: #FFFFFF; + margin: 0; + } + .#{$choices-selector}__button { + background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==); + padding: 0; + background-size: 8px; + height: 100%; + position: absolute; + top: 50%; + right: 0; + margin-top: -10px; + margin-right: 25px; + height: 20px; + width: 20px; + border-radius: 10em; + opacity: .5; + &:hover, &:focus { + opacity: 1; + } + &:focus { + box-shadow: 0px 0px 0px 2px $choices-highlight-color; + } + } + &:after { + content: ""; + height: 0; + width: 0; + border-style: solid; + border-color: $choices-text-color transparent transparent transparent; + border-width: 5px; + position: absolute; + right: 11.5px; + top: 50%; + margin-top: -2.5px; + pointer-events: none; + } + &.is-open:after { + border-color: transparent transparent $choices-text-color transparent; + margin-top: -7.5px; + } + &[dir="rtl"] { + &:after { + left: 11.5px; + right: auto; + } + .#{$choices-selector}__button { + right: auto; + left: 0; + margin-left: 25px; + margin-right: 0; + } + } +} + +.#{$choices-selector}[data-type*="select-multiple"], .#{$choices-selector}[data-type*="text"] { + .#{$choices-selector}__inner { + cursor: text; + } + .#{$choices-selector}__button { + position: relative; + display: inline-block; + margin-top: 0; + margin-right: -$choices-button-offset/2; + margin-bottom: 0; + margin-left: $choices-button-offset; + padding-left: $choices-button-offset*2; + border-left: 1px solid darken($choices-primary-color, 10%); + background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==); + background-size: $choices-button-dimension; + width: $choices-button-dimension; + line-height: 1; + opacity: .75; + &:hover, &:focus { + opacity: 1; + } + } +} + +.#{$choices-selector}__inner { + display: inline-block; + vertical-align: top; + width: 100%; + background-color: $choices-bg-color; + padding: 7.5px 7.5px 3.75px; + border: 1px solid $choices-keyline-color; + border-radius: $choices-border-radius; + font-size: $choices-font-size-md; + min-height: 44px; + overflow: hidden; + .is-focused &, .is-open & { + border-color: darken($choices-keyline-color, 15%); + } + .is-open & { + border-radius: $choices-border-radius $choices-border-radius 0 0; + } + .is-flipped.is-open & { + border-radius: 0 0 $choices-border-radius $choices-border-radius; + } +} + +.#{$choices-selector}__list { + margin: 0; + padding-left: 0; + list-style: none; +} + +.#{$choices-selector}__list--single { + display: inline-block; + padding: 4px 16px 4px 4px; + width: 100%; + [dir="rtl"] & { + padding-right: 4px; + padding-left: 16px; + } + .#{$choices-selector}__item { + width: 100%; + } +} + +.#{$choices-selector}__list--multiple { + display: inline; + .#{$choices-selector}__item { + display: inline-block; + vertical-align: middle; + border-radius: $choices-border-radius-item; + padding: 4px 10px; + font-size: $choices-font-size-sm; + font-weight: 500; + margin-right: 3.75px; + margin-bottom: 3.75px; + background-color: $choices-primary-color; + border: 1px solid darken($choices-primary-color, 5%); + color: #FFFFFF; + word-break: break-all; + &[data-deletable] { + padding-right: 5px; + } + [dir="rtl"] & { + margin-right: 0; + margin-left: 3.75px; + } + &.is-highlighted { + background-color: darken($choices-primary-color, 5%); + border: 1px solid darken($choices-primary-color, 10%); + } + .is-disabled & { + background-color: darken($choices-disabled-color, 25%); + border: 1px solid darken($choices-disabled-color, 35%); + } + } +} + +.#{$choices-selector}__list--dropdown { + display: none; + z-index: 1; + position: absolute; + width: 100%; + background-color: $choices-bg-color-dropdown; + border: 1px solid $choices-keyline-color; + top: 100%; + margin-top: -1px; + border-bottom-left-radius: $choices-border-radius; + border-bottom-right-radius: $choices-border-radius; + overflow: hidden; + word-break: break-all; + &.is-active { + display: block; + } + .is-open & { + border-color: darken($choices-keyline-color, 15%); + } + .is-flipped & { + top: auto; + bottom: 100%; + margin-top: 0; + margin-bottom: -1px; + border-radius: .25rem .25rem 0 0; + } + .#{$choices-selector}__list { + position: relative; + max-height: 300px; + overflow: auto; + -webkit-overflow-scrolling: touch; + will-change: scroll-position; + } + .#{$choices-selector}__item { + position: relative; + padding: 10px; + font-size: $choices-font-size-md; + [dir="rtl"] & { + text-align: right; + } + } + .#{$choices-selector}__item--selectable { + @media (min-width: 640px) { + padding-right: 100px; + &:after { + content: attr(data-select-text); + font-size: $choices-font-size-sm; + opacity: 0; + position: absolute; + right: 10px; + top: 50%; + transform: translateY(-50%); + } + [dir="rtl"] & { + text-align: right; + padding-left: 100px; + padding-right: 10px; + &:after { + right: auto; + left: 10px; + } + } + } + &.is-highlighted { + background-color: mix(#000000, #FFFFFF, 5%); + &:after { + opacity: .5; + } + } + } +} + +.#{$choices-selector}__item { + cursor: default; +} + +.#{$choices-selector}__item--selectable { + cursor: pointer; +} + +.#{$choices-selector}__item--disabled { + cursor: not-allowed; + user-select: none; + opacity: .5; +} + +.#{$choices-selector}__heading { + font-weight: 600; + font-size: $choices-font-size-sm; + padding: 10px; + border-bottom: 1px solid lighten($choices-keyline-color, 10%); + color: lighten(#333, 30%); +} + +.#{$choices-selector}__button { + text-indent: -9999px; + -webkit-appearance: none; + appearance: none; + border: 0; + background-color: transparent; + background-repeat: no-repeat; + background-position: center; + cursor: pointer; + &:focus { + outline: none; + } +} + +.#{$choices-selector}__input { + display: inline-block; + vertical-align: baseline; + background-color: $choices-bg-color; + font-size: $choices-font-size-md; + margin-bottom: 5px; + border: 0; + border-radius: 0; + max-width: 100%; + padding: 4px 0 4px 2px; + &:focus { + outline: 0; + } + [dir="rtl"] & { + padding-right: 2px; + padding-left: 0; + } +} + +.#{$choices-selector}__placeholder { + opacity: .5; +} + +/*===== End of Choices ======*/ diff --git a/addons/default/visiosoft/multiple-field_type/resources/scss/lookup.scss b/addons/default/visiosoft/multiple-field_type/resources/scss/lookup.scss new file mode 100644 index 000000000..05704c2b5 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/scss/lookup.scss @@ -0,0 +1,21 @@ +.multiple-field_type { + + .selected { + margin-top: 15px; + + table tr td { + padding: 0.5rem; + border-top: none; + border-bottom: none; + + &:first-of-type { + width: 0; + padding-right: 15px; + } + + &:last-of-type { + padding-left: 15px; + } + } + } +} diff --git a/addons/default/visiosoft/multiple-field_type/resources/scss/tags.scss b/addons/default/visiosoft/multiple-field_type/resources/scss/tags.scss new file mode 100644 index 000000000..60eb886f9 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/scss/tags.scss @@ -0,0 +1,5 @@ +.multiple-field_type { + .choices { + z-index: 100; + } +} diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/checkboxes.twig b/addons/default/visiosoft/multiple-field_type/resources/views/checkboxes.twig new file mode 100644 index 000000000..c8e116c79 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/views/checkboxes.twig @@ -0,0 +1,41 @@ +
+ + {% for key, title in field_type.options %} + + {% if title is iterable %} +

+ {{ trans(key) }} + + {% for key, title in title %} + + {% endfor %} +

+ {% else %} + + {% endif %} + + {% endfor %} + +
diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/filter.twig b/addons/default/visiosoft/multiple-field_type/resources/views/filter.twig new file mode 100644 index 000000000..3f3e58749 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/views/filter.twig @@ -0,0 +1,11 @@ + diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/lookup.twig b/addons/default/visiosoft/multiple-field_type/resources/views/lookup.twig new file mode 100644 index 000000000..1aa990961 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/views/lookup.twig @@ -0,0 +1,24 @@ +{{ asset_add('styles.css', 'visiosoft.field_type.multiple::css/lookup.scss') }} +{{ asset_add('scripts.js', 'visiosoft.field_type.multiple::js/lookup.js') }} + + + + + + {{ img('visiosoft.field_type.multiple::images/plus.svg').data|raw }} + {{ trans('streams::button.select') }} + + + + +
+ {{ field_type.table|raw }} +
+ + diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax.twig b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax.twig new file mode 100644 index 000000000..ebdbf87f0 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax.twig @@ -0,0 +1,53 @@ +{{ asset_add("scripts.js", "streams::js/table/table.js") }} + +{% if not actions.isEmpty() %} + {{ asset_add("scripts.js", "streams::js/table/actions.js") }} +{% endif %} + +{% if table.options.sortable %} + {{ asset_add("scripts.js", "streams::js/table/sortable.js") }} +{% endif %} + +{{ view("visiosoft.field_type.multiple::table/ajax/heading", {'table': table}) }} + +{{ view("visiosoft.field_type.multiple::table/ajax/views", {'table': table}) }} +{{ view("visiosoft.field_type.multiple::table/ajax/filters", {'table': table}) }} + +{% if table.rows.isEmpty() %} + {% block no_results %} +
+

+ {{ trans(table.options.get('no_results_message', 'streams::message.no_results')) }} +

+
+ {% endblock %} +{% endif %} + +{% if not table.rows.isEmpty() %} + + {{ form_open({'url': url_full(), 'class': 'ajax'}) }} + +
+ + + {{ view("visiosoft.field_type.multiple::table/ajax/header", {'table': table}) }} + + {% block body %} + {{ view("visiosoft.field_type.multiple::table/partials/body", {'table': table}) }} + {% endblock %} + + {{ view("streams::table/partials/footer", {'table': table}) }} + +
+
+ + {{ form_close() }} + +{% endif %} diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/filters.twig b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/filters.twig new file mode 100644 index 000000000..742d77703 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/filters.twig @@ -0,0 +1,27 @@ +{% if not table.filters.isEmpty() %} +
+ + {{ form_open({'method': 'get', 'id': 'filters', 'url': url_full(), 'class': 'ajax form-inline'}) }} + + + + {% for filter in table.filters %} +
+ {{ filter.input|raw }} +
+ {% endfor %} + +
+ + + {{ icon(table.options.filters.clear_icon ? table.options.filters.clear_icon) }} + {{ trans(table.options.filters.clear_text ?: 'streams::button.clear') }} + +
+ {{ form_close() }} + +
+{% endif %} diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/header.twig b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/header.twig new file mode 100644 index 000000000..5e0af80c6 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/header.twig @@ -0,0 +1,36 @@ + + + + {% if table.options.sortable %} +   + {% endif %} + + {% if not table.actions.isEmpty() %} + + + + {% endif %} + + {% for header in table.headers %} + + {% if header.sortable %} + + {{ html_link(url_current() ~ '?' ~ header.getQueryString(), trans(header.heading), {'class': 'ajax'}) }} + + {% if header.direction == 'asc' %} + {{ icon('sort-ascending', 'text-muted') }} + {% elseif header.direction == 'desc' %} + {{ icon('sort-descending', 'text-muted') }} + {% else %} + {{ icon('sortable', 'text-muted') }} + {% endif %} + + {% else %} + {{ trans(header.heading)|raw }} + {% endif %} + + {% endfor %} + +   + + diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/heading.twig b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/heading.twig new file mode 100644 index 000000000..2cefe0a14 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/heading.twig @@ -0,0 +1,19 @@ +{% if (table.options.title or table.options.description) and table.options.title %} + +{% endif %} diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/views.twig b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/views.twig new file mode 100644 index 000000000..43250ffc0 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/views.twig @@ -0,0 +1,14 @@ +{% if not table.views.isEmpty() %} + +{% endif %} diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/table/partials/body.twig b/addons/default/visiosoft/multiple-field_type/resources/views/table/partials/body.twig new file mode 100644 index 000000000..176f1dbd0 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/views/table/partials/body.twig @@ -0,0 +1,31 @@ + +{% for row in table.rows %} + + + {% if table.options.sortable %} + + {{ icon('fa fa-arrows handle') }} + + + {% endif %} + + {% if not table.actions.isEmpty() %} + + + + {% endif %} + + {% for column in row.columns %} + + {{ column.value|raw }} + + {% endfor %} + + + {{ buttons(row.buttons)|raw }} + + + +{% endfor %} + diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/table/table.twig b/addons/default/visiosoft/multiple-field_type/resources/views/table/table.twig new file mode 100644 index 000000000..e11a8d90a --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/views/table/table.twig @@ -0,0 +1,34 @@ +{{ asset_add("scripts.js", "streams::js/table/jquery-sortable.js") }} + +{% if not table.rows.isEmpty() %} + {% block panel %} +
+ +
+ + + {{ view("visiosoft.field_type.multiple::table/ajax/header", {'table': table}) }} + + {% block body %} + {{ view("visiosoft.field_type.multiple::table/partials/body", {'table': table}) }} + {% endblock %} + +
+
+ +
+ {% endblock %} +{% else %} + + {% block no_results %} +
+
+ {{ trans(table.options.get('no_results_message', 'streams::message.no_results')) }} +
+
+ {% endblock %} + +{% endif %} \ No newline at end of file diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/tags.twig b/addons/default/visiosoft/multiple-field_type/resources/views/tags.twig new file mode 100644 index 000000000..07df2c621 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/resources/views/tags.twig @@ -0,0 +1,22 @@ +{{ asset_add("styles.css", "visiosoft.field_type.multiple::css/choices.css", ["as:jshjohnson/Choices.css"]) }} +{{ asset_add("scripts.js", "visiosoft.field_type.multiple::js/choices.min.js", ["as:jshjohnson/Choices.js"]) }} +{{ asset_add("styles.css", "visiosoft.field_type.multiple::css/tags.css") }} +{{ asset_add("scripts.js", "visiosoft.field_type.multiple::js/tags.js") }} + + + + + {{ trans('visiosoft.field_type.multiple::input.help') }} + diff --git a/addons/default/visiosoft/multiple-field_type/src/Command/BuildOptions.php b/addons/default/visiosoft/multiple-field_type/src/Command/BuildOptions.php new file mode 100644 index 000000000..e80c25f53 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/Command/BuildOptions.php @@ -0,0 +1,53 @@ +fieldType = $fieldType; + } + + /** + * Handle the command. + * + * @param Container $container + */ + public function handle(Container $container) + { + if ($options = $this->fieldType->config('options')) { + + $this->fieldType->setOptions($options); + + return; + } + + $model = $this->fieldType->getRelatedModel(); + $handler = $this->fieldType->config('handler', $model->getMultipleFieldTypeOptionsHandler()); + + if (!class_exists($handler) && !str_contains($handler, '@')) { + $handler = array_get($this->fieldType->getHandlers(), $handler); + } + + if (is_string($handler) && !str_contains($handler, '@')) { + $handler .= '@handle'; + } + + $container->call($handler, ['fieldType' => $this->fieldType]); + } +} diff --git a/addons/default/visiosoft/multiple-field_type/src/Command/GetConfiguration.php b/addons/default/visiosoft/multiple-field_type/src/Command/GetConfiguration.php new file mode 100644 index 000000000..d7d95a55b --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/Command/GetConfiguration.php @@ -0,0 +1,39 @@ +key = $key; + } + + /** + * Handle the command. + * + * @param Repository $cache + * @return Collection + */ + public function handle(Repository $cache) + { + return new Collection( + array_merge(Crypt::decrypt($this->key), ['key' => $this->key]) + ); + } +} diff --git a/addons/default/visiosoft/multiple-field_type/src/Handler/Related.php b/addons/default/visiosoft/multiple-field_type/src/Handler/Related.php new file mode 100644 index 000000000..69e670c3e --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/Handler/Related.php @@ -0,0 +1,65 @@ +getRelatedModel(); + + $query = $model->newQuery(); + $results = $query->get(); + + try { + + /** + * Try and use a non-parsing pattern. + */ + if (strpos($fieldType->config('title_name', $model->getTitleName()), '{') === false) { + $fieldType->setOptions( + $results->pluck( + $fieldType->config('title_name', $model->getTitleName()), + $fieldType->config('key_name', $model->getKeyName()) + )->all() + ); + } + + /** + * Try and use a parsing pattern. + */ + if (strpos($fieldType->config('title_name', $model->getTitleName()), '{') !== false) { + $fieldType->setOptions( + array_combine( + $results->map( + function ($item) use ($fieldType, $model) { + return data_get($item, $fieldType->config('key_name', $model->getKeyName())); + } + )->all(), + $results->map( + function ($item) use ($fieldType, $model, $value) { + return $value->make($fieldType->config('title_name', $model->getTitleName()), $item); + } + )->all() + ) + ); + } + } catch (\Exception $e) { + $fieldType->setOptions( + $results->pluck( + $model->getTitleName(), + $model->getKeyName() + )->all() + ); + } + } +} diff --git a/addons/default/visiosoft/multiple-field_type/src/Http/Controller/LookupController.php b/addons/default/visiosoft/multiple-field_type/src/Http/Controller/LookupController.php new file mode 100644 index 000000000..6bc0c6961 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/Http/Controller/LookupController.php @@ -0,0 +1,106 @@ +dispatch(new GetConfiguration($key)); + + $related = $container->make($config->get('related')); + + if ($table = $config->get('lookup_table')) { + $table = $container->make($table); + } else { + $table = $related->newMultipleFieldTypeLookupTableBuilder(); + } + + /* @var LookupTableBuilder $table */ + $table->setConfig($config) + ->setModel($related); + + return $table->render(); + } + + /** + * @param Container $container + * @param MultipleFieldType $fieldType + * @param $key + */ + public function json(Container $container, MultipleFieldType $fieldType, $key) + { + /* @var Collection $config */ + $config = $this->dispatch(new GetConfiguration($key)); + + $fieldType->mergeConfig($config->all()); + + /* @var EloquentModel $model */ + $model = $container->make($config->get('related')); + + $data = []; + + /* @var EntryInterface $item */ + foreach ($model->all() as $item) { + $data[] = (object)[ + 'id' => $item->getId(), + 'text' => $item->getTitle(), + ]; + } + + return $this->response->json($data); + } + + /** + * Return the selected entries. + * + * @param SelectedTableBuilder $table + * @param MultipleFieldType $fieldType + * @param $key + * @return null|string + */ + public function selected(Container $container, MultipleFieldType $fieldType, $key) + { + /* @var Collection $config */ + $config = $this->dispatch(new GetConfiguration($key)); + + $fieldType->mergeConfig($config->all()); + $fieldType->setField($config->get('field')); + $fieldType->setEntry($this->container->make($config->get('entry'))); + + $related = $container->make($config->get('related')); + + if ($table = $config->get('selected_table')) { + $table = $container->make($table); + } else { + $table = $related->newMultipleFieldTypeSelectedTableBuilder(); + } + + /* @var SelectedTableBuilder $table */ + $table->setSelected(array_filter(explode(',', $this->request->get('uploaded')))) + ->setModel($config->get('related')) + ->setFieldType($fieldType) + ->setConfig($config) + ->build() + ->load(); + + return $table->getTableContent(); + } +} diff --git a/addons/default/visiosoft/multiple-field_type/src/MultipleFieldType.php b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldType.php new file mode 100644 index 000000000..34d7c42cd --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldType.php @@ -0,0 +1,357 @@ + 'Visiosoft\MultipleFieldType\Handler\Related@handle', + //'fields' => 'Visiosoft\MultipleFieldType\Handler\Fields@handle', + //'assignments' => 'Visiosoft\MultipleFieldType\Handler\Assignments@handle' + ]; + + /** + * The field type rules. + * + * @var array + */ + protected $rules = [ + 'array', + ]; + + /** + * The field type config. + * + * @var array + */ + protected $config = [ + 'mode' => 'tags', + ]; + + /** + * The select input options. + * + * @var null|array + */ + protected $options = null; + + /** + * The cache repository. + * + * @var Repository + */ + protected $cache; + + /** + * The service container. + * + * @var Container + */ + protected $container; + + /** + * Create a new MultipleFieldType instance. + * + * @param Repository $cache + * @param Container $container + */ + public function __construct(Repository $cache, Container $container) + { + $this->cache = $cache; + $this->container = $container; + } + + /** + * Return the ids. + * + * @return array|mixed|static + */ + public function ids() + { + $value = $this->getValue(); + + if (is_object($value)) { + $value = $value->pluck('id')->all(); + } + + return array_filter((array)$value); + } + + /** + * Get the rules. + * + * @return array + */ + public function getRules() + { + $rules = parent::getRules(); + + if ($min = array_get($this->getConfig(), 'min')) { + $rules[] = 'min:' . $min; + } + + if ($max = array_get($this->getConfig(), 'max')) { + $rules[] = 'max:' . $max; + } + + return $rules; + } + + /** + * Return the config key. + * + * @return string + */ + public function key() + { + return Crypt::encrypt(array_merge( + $this->getConfig(), + [ + 'field' => $this->getField(), + 'entry' => get_class($this->getEntry()), + ] + )); + } + + /** + * Value table. + * + * @return string + */ + public function table() + { + $value = $this->getValue(); + $related = $this->getRelatedModel(); + + if ($table = $this->config('value_table')) { + $table = $this->container->make($table); + } else { + $table = $related->newMultipleFieldTypeValueTableBuilder(); + } + + /* @var ValueTableBuilder $table */ + $table->setConfig(new Collection($this->getConfig())) + ->setFieldType($this) + ->setModel($related); + + if (!$value instanceof EntryCollection) { + $table->setSelected((array)$value); + } + + if ($value instanceof EntryCollection) { + $table->setSelected($value->ids()); + } + + return $table + ->build() + ->load() + ->getTableContent(); + } + + /** + * Get the relation. + * + * @return BelongsToMany + */ + public function getRelation() + { + $entry = $this->getEntry(); + $model = $this->getRelatedModel(); + + return $entry->belongsToMany( + get_class($model), + $this->getPivotTableName(), + 'entry_id', + 'related_id' + )->orderBy($this->getPivotTableName() . '.sort_order', 'ASC'); + } + + /** + * Get the options. + * + * @return array + */ + public function getOptions() + { + if ($this->options === null) { + $this->dispatch(new BuildOptions($this)); + } + + return $this->options; + } + + /** + * Set the options. + * + * @param array $options + * @return $this + */ + public function setOptions(array $options) + { + $this->options = $options; + + return $this; + } + + /** + * Get the pre-defined handlers. + * + * @return array + */ + public function getHandlers() + { + return $this->handlers; + } + + /** + * Return the input view. + * + * @return string + */ + public function getInputView() + { + return $this->inputView ?: 'visiosoft.field_type.multiple::' . $this->config('mode'); + } + + /** + * Get the related model. + * + * @return EloquentModel + */ + public function getRelatedModel() + { + $model = $this->config('related'); + + if (strpos($model, '.')) { + + /* @var StreamInterface $stream */ + $stream = $this->dispatch(new GetStream($model)); + + return $stream->getEntryModel(); + } + + return $this->container->make($model); + } + + /** + * Get the pivot table. + * + * @return string + */ + public function getPivotTableName() + { + return $this->entry->getTableName() . '_' . $this->getField(); + } + + /** + * Get the post value. + * + * @param null $default + * @return array + */ + public function getPostValue($default = null) + { + if (is_array($value = parent::getPostValue($default))) { + return array_filter($value); + } + + return array_filter(explode(',', $value)); + } + + /** + * Get the class. + * + * @return null|string + */ + public function getClass() + { + if ($class = parent::getClass()) { + return $class; + } + + return $this->config('mode') == 'dropdown' ? 'custom-select form-control' : null; + } + + /** + * Handle saving the form data ourselves. + * + * @param FormBuilder $builder + */ + public function handle(FormBuilder $builder) + { + $entry = $builder->getFormEntry(); + + // See the accessor for how IDs are handled. + $entry->{$this->getField()} = $this->getPostValue(); + } + + /** + * Fired just before version comparison. + * + * @param EloquentCollection $related + */ + public function toArrayForComparison(EloquentCollection $related) + { + return $related->map( + function (EloquentModel $model) { + return array_diff_key( + $model->toArrayWithRelations(), + array_flip( + [ + 'id', + 'sort_order', + 'created_at', + 'created_by_id', + 'updated_at', + 'updated_by_id', + 'deleted_at', + 'deleted_by_id', + ] + ) + ); + } + )->toArray(); + } +} diff --git a/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeAccessor.php b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeAccessor.php new file mode 100644 index 000000000..63f22872a --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeAccessor.php @@ -0,0 +1,97 @@ +organizeSyncValue(explode(',', $value)); + } elseif (is_array($value)) { + $value = $this->organizeSyncValue($value); + } elseif ($value instanceof Collection) { + $value = $this->organizeSyncValue($value->filter()->all()); + } elseif ($value instanceof EntryInterface) { + $value = $this->organizeSyncValue([$value->getId()]); + } + + if (!$value) { + $this->fieldType->getRelation()->detach(); + + return; + } + + $this->fieldType->getRelation()->sync($value); + } + + /** + * Organize the value for sync. + * + * @param array $value + * @return array + */ + protected function organizeSyncValue(array $value) + { + + /** + * First clean our value. + */ + $value = array_filter(array_unique($value)); + + /** + * Next take the natural array + * key and make it the sort order. + */ + $value = array_combine( + array_values($value), + array_map( + function ($key) { + return [ + 'sort_order' => $key, + ]; + }, + array_keys($value) + ) + ); + + /** + * Lastly add the file_id + * relation column for sync. + */ + array_walk( + $value, + function (&$value, $key) { + $value['related_id'] = $key; + } + ); + + return $value; + } + + /** + * Get the value. + * + * @return mixed + */ + public function get() + { + return $this->fieldType->getRelation(); + } +} diff --git a/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeQuery.php b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeQuery.php new file mode 100644 index 000000000..e6f3d08ab --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeQuery.php @@ -0,0 +1,27 @@ +getStream(); + + $query->leftJoin( + $stream->getEntryTableName() . '_' . $filter->getField() . ' AS filter_' . $filter->getField(), + $stream->getEntryTableName() . '.id', + '=', + 'filter_' . $filter->getField() . '.entry_id' + )->where('filter_' . $filter->getField() . '.related_id', $filter->getValue()); + } +} diff --git a/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeSchema.php b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeSchema.php new file mode 100644 index 000000000..d11d54cdc --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeSchema.php @@ -0,0 +1,66 @@ +getTable() . '_' . $this->fieldType->getField(); + + $this->schema->dropIfExists($table); + + $this->schema->create( + $table, + function (Blueprint $table) { + + $table->increments('id'); + $table->integer('entry_id'); + $table->integer('related_id'); + $table->integer('sort_order')->nullable(); + + $table->unique( + ['entry_id', 'related_id'], + md5($table->getTable() . '_' . $this->fieldType->getField().'-unique-relations') + ); + } + ); + } + + /** + * Rename the pivot table. + * + * @param Blueprint $table + * @param FieldType $from + */ + public function renameColumn(Blueprint $table, FieldType $from) + { + $this->schema->rename( + $table->getTable() . '_' . $from->getField(), + $table->getTable() . '_' . $this->fieldType->getField() + ); + } + + /** + * Drop the pivot table. + * + * @param Blueprint $table + */ + public function dropColumn(Blueprint $table) + { + $this->schema->dropIfExists( + $table->getTable() . '_' . $this->fieldType->getField() + ); + } + +} diff --git a/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeServiceProvider.php b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeServiceProvider.php new file mode 100644 index 000000000..efdb75d3d --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeServiceProvider.php @@ -0,0 +1,102 @@ + MultipleFieldTypeAccessor::class, + ]; + + /** + * The addon routes. + * + * @var array + */ + protected $routes = [ + 'streams/multiple-field_type/json/{key}' => 'Visiosoft\MultipleFieldType\Http\Controller\LookupController@json', + 'streams/multiple-field_type/index/{key}' => 'Visiosoft\MultipleFieldType\Http\Controller\LookupController@index', + 'streams/multiple-field_type/selected/{key}' => 'Visiosoft\MultipleFieldType\Http\Controller\LookupController@selected', + ]; + + /** + * Register the addon. + * + * @param EntryModel $model + */ + public function register(EntryModel $model) + { + $model->bind( + 'new_multiple_field_type_lookup_table_builder', + function (Container $container) { + + /* @var EntryInterface $this */ + $builder = $this->getBoundModelNamespace() . '\\Support\\MultipleFieldType\\LookupTableBuilder'; + + if (class_exists($builder)) { + return $container->make($builder); + } + + return $container->make(LookupTableBuilder::class); + } + ); + + $model->bind( + 'new_multiple_field_type_value_table_builder', + function (Container $container) { + + /* @var EntryInterface $this */ + $builder = $this->getBoundModelNamespace() . '\\Support\\MultipleFieldType\\ValueTableBuilder'; + + if (class_exists($builder)) { + return $container->make($builder); + } + + return $container->make(ValueTableBuilder::class); + } + ); + + $model->bind( + 'new_multiple_field_type_selected_table_builder', + function (Container $container) { + + /* @var EntryInterface $this */ + $builder = $this->getBoundModelNamespace() . '\\Support\\MultipleFieldType\\SelectedTableBuilder'; + + if (class_exists($builder)) { + return $container->make($builder); + } + + return $container->make(SelectedTableBuilder::class); + } + ); + + $model->bind( + 'get_multiple_field_type_options_handler', + function () { + + /* @var EntryInterface $this */ + $handler = $this->getBoundModelNamespace() . '\\Support\\MultipleFieldType\\OptionsHandler'; + + if (class_exists($handler)) { + return $handler; + } + + return Related::class; + } + ); + } +} diff --git a/addons/default/visiosoft/multiple-field_type/src/Support/Config/RelatedHandler.php b/addons/default/visiosoft/multiple-field_type/src/Support/Config/RelatedHandler.php new file mode 100644 index 000000000..64113992c --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/Support/Config/RelatedHandler.php @@ -0,0 +1,38 @@ +visible() as $stream) { + + $addon = ucwords(str_replace('_', ' ', $stream->getNamespace())); + + $model = $stream->getEntryModelName(); + + array_set($options, "{$addon}.{$model}", $stream->getName()); + } + + foreach ($options as $namespace) { + ksort($namespace); + } + + ksort($options); + + $fieldType->setOptions($options); + } +} diff --git a/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableActions.php b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableActions.php new file mode 100644 index 000000000..a51a8de73 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableActions.php @@ -0,0 +1,22 @@ +setActions( + [ + 'add_selected' => [ + 'data-key' => $builder->config('key'), + ], + ] + ); + } +} diff --git a/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableBuilder.php b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableBuilder.php new file mode 100644 index 000000000..ea33017b6 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableBuilder.php @@ -0,0 +1,96 @@ + false, + 'title' => 'visiosoft.field_type.multiple::message.select_entries', + 'table_view' => 'visiosoft.field_type.multiple::table/ajax', + ]; + + /** + * Return a config value. + * + * @param $key + * @param null $default + * @return mixed + */ + public function config($key, $default = null) + { + return $this->config->get($key, $default); + } + + /** + * Get the config. + * + * @return Collection|null + */ + public function getConfig() + { + return $this->config; + } + + /** + * Set the config. + * + * @param Collection $config + * @return $this + */ + public function setConfig(Collection $config) + { + $this->config = $config; + + return $this; + } +} diff --git a/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableButtons.php b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableButtons.php new file mode 100644 index 000000000..81c20bf2c --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableButtons.php @@ -0,0 +1,24 @@ +setButtons( + [ + 'add' => [ + 'data-entry' => 'entry.id', + 'data-key' => $builder->config('key'), + ], + ] + ); + } +} diff --git a/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableColumns.php b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableColumns.php new file mode 100644 index 000000000..27b812ebd --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableColumns.php @@ -0,0 +1,31 @@ +getTableStream(); + $column = $stream->getTitleColumn(); + + if ($column == 'id') { + + $builder->setColumns([]); + + return; + } + + $builder->setColumns( + [ + $column, + ] + ); + } +} diff --git a/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableFilters.php b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableFilters.php new file mode 100644 index 000000000..954e3eba6 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableFilters.php @@ -0,0 +1,35 @@ +getTableStream(); + $filter = $stream->getTitleColumn(); + + if ($filter == 'id') { + + $builder->setFilters([]); + + return; + } + + $builder->setFilters( + [ + 'search' => [ + 'fields' => [ + $filter, + ], + ], + ] + ); + } +} diff --git a/addons/default/visiosoft/multiple-field_type/src/Table/SelectedTableBuilder.php b/addons/default/visiosoft/multiple-field_type/src/Table/SelectedTableBuilder.php new file mode 100644 index 000000000..b6fb2b9b6 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/Table/SelectedTableBuilder.php @@ -0,0 +1,175 @@ + [ + 'data-dismiss' => 'multiple', + 'data-entry' => 'entry.id', + ], + ]; + + /** + * The table options. + * + * @var array + */ + protected $options = [ + 'limit' => 9999, + 'show_headers' => false, + 'sortable_headers' => false, + 'table_view' => 'visiosoft.field_type.multiple::table/table', + ]; + + /** + * Fired just before querying. + * + * @param Builder $query + */ + public function onQuerying(Builder $query) + { + $uploaded = $this->getSelected(); + $fieldType = $this->getFieldType(); + + /* + * If we have the entry available then + * we can determine saved sort order. + */ + $related = $fieldType->getRelatedModel(); + + $query->whereIn($related->getTableName() . '.id', $uploaded ?: 0); + } + + /** + * Return a config value. + * + * @param $key + * @param null $default + * @return mixed + */ + public function config($key, $default = null) + { + return $this->config->get($key, $default); + } + + /** + * Get the config. + * + * @return Collection|null + */ + public function getConfig() + { + return $this->config; + } + + /** + * Set the config. + * + * @param Collection $config + * @return $this + */ + public function setConfig(Collection $config) + { + $this->config = $config; + + return $this; + } + + /** + * Get the selected value. + * + * @return array + */ + public function getSelected() + { + return $this->selected; + } + + /** + * Get the selected value. + * + * @param array $selected + * @return $this + */ + public function setSelected(array $selected) + { + $this->selected = $selected; + + return $this; + } + + /** + * Get the field type. + * + * @return MultipleFieldType|null + */ + public function getFieldType() + { + return $this->fieldType; + } + + /** + * Set the field type. + * + * @param MultipleFieldType $fieldType + * @return $this + */ + public function setFieldType(MultipleFieldType $fieldType) + { + $this->fieldType = $fieldType; + + return $this; + } + + /** + * Set the table entries. + * + * @param \Illuminate\Support\Collection $entries + * @return $this + */ + public function setTableEntries(\Illuminate\Support\Collection $entries) + { + if (!$this->getFieldType()) { + $entries = $entries->sort( + function ($a, $b) { + return array_search($a->id, $this->getSelected()) - array_search($b->id, $this->getSelected()); + } + ); + } + + return parent::setTableEntries($entries); + } +} diff --git a/addons/default/visiosoft/multiple-field_type/src/Table/ValueTableBuilder.php b/addons/default/visiosoft/multiple-field_type/src/Table/ValueTableBuilder.php new file mode 100644 index 000000000..213c20e46 --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/src/Table/ValueTableBuilder.php @@ -0,0 +1,182 @@ + [ + 'data-dismiss' => 'multiple', + 'data-entry' => 'entry.id', + ], + ]; + + /** + * The table options. + * + * @var array + */ + protected $options = [ + 'limit' => 9999, + 'show_headers' => false, + 'sortable_headers' => false, + 'table_view' => 'visiosoft.field_type.multiple::table/table', + ]; + + /** + * Fired just before querying. + * + * @param Builder $query + */ + public function onQuerying(Builder $query) + { + $uploaded = $this->getSelected(); + $fieldType = $this->getFieldType(); + + /* + * If we have the entry available then + * we can determine saved sort order. + */ + $table = $fieldType->getPivotTableName(); + $related = $fieldType->getRelatedModel(); + $entry = $fieldType->getEntry(); + + if ($entry->getId() && $related && !$uploaded) { + $query->join($table, $table . '.related_id', '=', $related->getTableName() . '.id'); + $query->where($table . '.entry_id', $entry->getId()); + $query->orderBy($table . '.sort_order', 'ASC'); + } elseif ($related) { + $query->whereIn($related->getTableName() . '.id', $uploaded ?: [0]); + } + } + + /** + * Return a config value. + * + * @param $key + * @param null $default + * @return mixed + */ + public function config($key, $default = null) + { + return $this->config->get($key, $default); + } + + /** + * Get the config. + * + * @return Collection|null + */ + public function getConfig() + { + return $this->config; + } + + /** + * Set the config. + * + * @param Collection $config + * @return $this + */ + public function setConfig(Collection $config) + { + $this->config = $config; + + return $this; + } + + /** + * Get the selected value. + * + * @return array + */ + public function getSelected() + { + return $this->selected; + } + + /** + * Get the selected value. + * + * @param array $selected + * @return $this + */ + public function setSelected(array $selected) + { + $this->selected = $selected; + + return $this; + } + + /** + * Get the field type. + * + * @return MultipleFieldType|null + */ + public function getFieldType() + { + return $this->fieldType; + } + + /** + * Set the field type. + * + * @param MultipleFieldType $fieldType + * @return $this + */ + public function setFieldType(MultipleFieldType $fieldType) + { + $this->fieldType = $fieldType; + + return $this; + } + + /** + * Set the table entries. + * + * @param \Illuminate\Support\Collection $entries + * @return $this + */ + public function setTableEntries(\Illuminate\Support\Collection $entries) + { + if (!$this->getFieldType()) { + $entries = $entries->sort( + function ($a, $b) { + return array_search($a->id, $this->getSelected()) - array_search($b->id, $this->getSelected()); + } + ); + } + + return parent::setTableEntries($entries); + } +} diff --git a/addons/default/visiosoft/multiple-field_type/webpack.mix.js b/addons/default/visiosoft/multiple-field_type/webpack.mix.js new file mode 100644 index 000000000..95baa13ef --- /dev/null +++ b/addons/default/visiosoft/multiple-field_type/webpack.mix.js @@ -0,0 +1,57 @@ +let mix = require('laravel-mix'); + +/* + |-------------------------------------------------------------------------- + | Mix Asset Management + |-------------------------------------------------------------------------- + | + | Mix provides a clean, fluent API for defining some Webpack build steps + | for your Laravel application. By default, we are compiling the Sass + | file for the application as well as bundling up all the JS files. + | + */ + +mix + .copy('node_modules/choices/choices.js', 'resources/js') + .sass('resources/scss/choices.scss', 'resources/css') + .sass('resources/scss/lookup.scss', 'resources/css') + .sass('resources/scss/tags.scss', 'resources/css') + .options({ + processCssUrls: false + }); + +// Full API +// mix.js(src, output); +// mix.react(src, output); <-- Identical to mix.js(), but registers React Babel compilation. +// mix.preact(src, output); <-- Identical to mix.js(), but registers Preact compilation. +// mix.coffee(src, output); <-- Identical to mix.js(), but registers CoffeeScript compilation. +// mix.ts(src, output); <-- TypeScript support. Requires tsconfig.json to exist in the same folder as webpack.mix.js +// mix.extract(vendorLibs); +// mix.sass(src, output); +// mix.less(src, output); +// mix.stylus(src, output); +// mix.postCss(src, output, [require('postcss-some-plugin')()]); +// mix.browserSync('my-site.test'); +// mix.combine(files, destination); +// mix.babel(files, destination); <-- Identical to mix.combine(), but also includes Babel compilation. +// mix.copy(from, to); +// mix.copyDirectory(fromDir, toDir); +// mix.minify(file); +// mix.sourceMaps(); // Enable sourcemaps +// mix.version(); // Enable versioning. +// mix.disableNotifications(); +// mix.setPublicPath('path/to/public'); +// mix.setResourceRoot('prefix/for/resource/locators'); +// mix.autoload({}); <-- Will be passed to Webpack's ProvidePlugin. +// mix.webpackConfig({}); <-- Override webpack.config.js, without editing the file directly. +// mix.babelConfig({}); <-- Merge extra Babel configuration (plugins, etc.) with Mix's default. +// mix.then(function () {}) <-- Will be triggered each time Webpack finishes building. +// mix.extend(name, handler) <-- Extend Mix's API with your own components. +// mix.options({ +// extractVueStyles: false, // Extract .vue component styling to file, rather than inline. +// globalVueStyles: file, // Variables file to be imported in every component. +// processCssUrls: true, // Process/optimize relative stylesheet url()'s. Set to false, if you don't want them touched. +// purifyCss: false, // Remove unused CSS selectors. +// terser: {}, // Terser-specific options. https://github.com/webpack-contrib/terser-webpack-plugin#options +// postCss: [] // Post-CSS options: https://github.com/postcss/postcss/blob/master/docs/plugins.md +// });