diff --git a/resources/js/components/content/Blocks.vue b/resources/js/components/content/Blocks.vue
index df9106e..09c2ad4 100644
--- a/resources/js/components/content/Blocks.vue
+++ b/resources/js/components/content/Blocks.vue
@@ -1,9 +1,9 @@
- {
>
- Crea una nuova Playlist
+ Crea un nuovo blocco dinamico
diff --git a/resources/js/components/content/partials/SmartBlockEditor.vue b/resources/js/components/content/partials/SmartBlockEditor.vue
new file mode 100644
index 0000000..466dd0d
--- /dev/null
+++ b/resources/js/components/content/partials/SmartBlockEditor.vue
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+ Torna indietro
+ Anteprima
+ Salva
+
+
+
+
+
+ {{item}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/components/content/partials/fields/smartblock/RadioGroup.vue b/resources/js/components/content/partials/fields/smartblock/RadioGroup.vue
new file mode 100644
index 0000000..196c1d7
--- /dev/null
+++ b/resources/js/components/content/partials/fields/smartblock/RadioGroup.vue
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/components/content/partials/fields/smartblock/SmartBlockCriteria.vue b/resources/js/components/content/partials/fields/smartblock/SmartBlockCriteria.vue
new file mode 100644
index 0000000..3102c2d
--- /dev/null
+++ b/resources/js/components/content/partials/fields/smartblock/SmartBlockCriteria.vue
@@ -0,0 +1,94 @@
+
+
+
+
+
+ Aggiungi un nuovo criterio
+
+
+
\ No newline at end of file
diff --git a/resources/js/components/content/partials/fields/smartblock/SmartBlockLimit.vue b/resources/js/components/content/partials/fields/smartblock/SmartBlockLimit.vue
new file mode 100644
index 0000000..fe811e4
--- /dev/null
+++ b/resources/js/components/content/partials/fields/smartblock/SmartBlockLimit.vue
@@ -0,0 +1,65 @@
+
+
+
+
+
+ Limite a
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/composables/content/models/smartblock/smartblock.ts b/resources/js/composables/content/models/smartblock/smartblock.ts
new file mode 100644
index 0000000..ef95ccb
--- /dev/null
+++ b/resources/js/composables/content/models/smartblock/smartblock.ts
@@ -0,0 +1,113 @@
+import {VCheckbox, VSelect, VTextarea, VTextField} from "vuetify/components";
+import RadioGroup from "@partials/fields/smartblock/RadioGroup.vue";
+import SmartBlockCriteria from "@partials/fields/smartblock/SmartBlockCriteria.vue";
+import SmartBlockLimit from "@partials/fields/smartblock/SmartBlockLimit.vue";
+
+export function smartblock(item) {
+ const visibleFields = {
+ name: {
+ title: 'Nome',
+ required: true,
+ },
+ description: {
+ title: 'Descrizione',
+ required: false
+ },
+ type: {
+ title: 'Tipologia blocco',
+ required: true,
+ radioButtons: [
+ {
+ label: 'Dinamico',
+ value: 'dynamic'
+ },
+ {
+ label: 'Statico',
+ value: 'static'
+ }
+ ]
+ },
+ criteria: {
+ title: 'Seleziona i criteri',
+ required: true
+ },
+ limit: {
+ title: 'Limite a',
+ required: true
+ },
+ repeated_tracks: {
+ title: 'Permetti al ripetizione delle tracce',
+ required: false
+ },
+ overflow_tracks: {
+ title: 'Permetti all\'ultima traccia di andare oltre il limite',
+ required: false
+ },
+ sort: {
+ title: 'Ordina per',
+ required: true
+ }
+ }
+
+ return () => {
+ const fields = {}
+ Object.keys(visibleFields).forEach((key) => {
+ fields[key] = {
+ label: visibleFields[key].title,
+ value: item !== null ? item[key] : '',
+ required: visibleFields[key].required,
+ component: VTextField
+ }
+ // console.log(fields)
+ switch (key) {
+ case 'name':
+ fields[key].component = VTextField
+ break
+ case 'description':
+ fields[key].component = VTextarea
+ break
+ case 'type':
+ fields[key].component = RadioGroup
+ fields[key].radioButtons = visibleFields[key].radioButtons
+ break
+ case 'criteria':
+ fields[key].component = SmartBlockCriteria
+ break
+ case 'limit':
+ fields[key].component = SmartBlockLimit
+ break
+ case 'repeated_tracks':
+ case 'overflow_tracks':
+ fields[key].component = VCheckbox
+ break
+ case 'sort':
+ fields[key].component = VSelect
+ fields[key].items = [
+ {
+ title: 'Random',
+ value: 'random'
+ },
+ {
+ title: 'Dal più recente',
+ value: 'newest'
+ },
+ {
+ title: 'Dal meno recente',
+ value: 'oldest'
+ },
+ {
+ title: 'Più recentemente andate in onda',
+ value: 'mostrecentplay'
+ },
+ {
+ title: 'Meno recentemente andate in onda',
+ value: 'leastrecentplay'
+ }
+ ]
+ break
+ }
+ })
+ // console.log(fields)
+ return fields
+ }
+}
\ No newline at end of file
diff --git a/resources/js/composables/content/models/smartblock/smartblockCriteria.ts b/resources/js/composables/content/models/smartblock/smartblockCriteria.ts
new file mode 100644
index 0000000..09c1d71
--- /dev/null
+++ b/resources/js/composables/content/models/smartblock/smartblockCriteria.ts
@@ -0,0 +1,84 @@
+export function smartblockCriteria() {
+ const criteria = [ {
+ type: 'string',
+ title: 'Nome dell\'Album',
+ value: 'album_title'
+ },
+ {
+ type: 'string',
+ title: 'Nome dell\'Artista',
+ value: 'artist_name'
+ },
+ {
+ type: 'number',
+ title: 'Bit Rate (kbps)',
+ value: 'bit_rate'
+ },
+ {
+ type: 'number',
+ title: 'BPM',
+ value: 'bpm'
+ },
+ {
+ type: 'string',
+ title: 'Genere',
+ value: 'genre'
+ },
+ {
+ type: 'TrackType',
+ title: 'Tipo di traccia',
+ value: 'track_type_id'
+ }
+
+ ]
+
+ const modifiers = [
+ {
+ value: 'contains',
+ title: 'contiene',
+ type: 'string'
+ },
+ {
+ value: 'does not contains',
+ title: 'non contiene',
+ type: 'string'
+ },
+ {
+ value: 'starts with',
+ title: 'comincia con',
+ type: 'string'
+ },
+ {
+ value: 'ends with',
+ title: 'finisce con',
+ type: 'string'
+ },
+ {
+ value: 'is greater than',
+ title: 'è maggiore di',
+ type: 'number'
+ },
+ {
+ value: 'is less than',
+ title: 'è minore di',
+ type: 'number'
+ },
+ {
+ value: 'is in the range',
+ title: 'è tra',
+ type: 'number'
+ },
+ {
+ value: 'is',
+ title: 'è uguale a',
+ type: 'all'
+ },
+ {
+ value: 'is not',
+ title: 'è diverso da',
+ type: 'all'
+ },
+ ]
+
+ return { criteria, modifiers }
+}
\ No newline at end of file