diff --git a/src/admin/pages/item-creation-page.vue b/src/admin/pages/item-creation-page.vue
index 057f927f8..3bac68915 100644
--- a/src/admin/pages/item-creation-page.vue
+++ b/src/admin/pages/item-creation-page.vue
@@ -31,13 +31,7 @@
imagens em formato jpg/png
-
+
Criar
Cancelar
@@ -96,10 +90,6 @@ export default {
this.getFields();
let data = {item_id: this.itemId, title: this.form.title, description: this.form.description, status: this.form.status};
this.updateItem(data);
- },
- extractFieldType(field_type) {
- let parts = field_type.split('\\');
- return 'tainacan-' + parts.pop().toLowerCase();
}
},
computed: {
diff --git a/src/classes/field-types/tainacan-form-item.vue b/src/classes/field-types/tainacan-form-item.vue
index f187ca280..0acccedca 100644
--- a/src/classes/field-types/tainacan-form-item.vue
+++ b/src/classes/field-types/tainacan-form-item.vue
@@ -1,10 +1,10 @@
-
-
-
+
+
+
@@ -18,14 +18,7 @@
export default {
name: 'TainacanFormItem',
props: {
- customComponentInput: String,
- name: { type: String },
- required: { type: Boolean },
- item_id: { type: Number },
- field_id: { type: Number },
- value: { },
- message: { type: [ String,Number ] },
- multiple: { type: String }
+ field: {}
},
data(){
return {
@@ -34,7 +27,6 @@
},
computed: {
inputsList() {
-
return this.inputs;
}
},
@@ -44,31 +36,27 @@
methods: {
changeValue(){
console.log(this.inputs);
- eventBus.$emit('input', { item_id: this.item_id, field_id: this.field_id, values: this.inputs, instance: this } );
+ eventBus.$emit('input', { item_id: this.field.item.id, field_id: this.field.field.id, values: this.inputs, instance: this } );
},
getValue(){
- if (this.value instanceof Array) {
- this.inputs = this.value;
+ if (this.field.value instanceof Array) {
+ this.inputs = this.field.value;
if (this.inputs.length == 0)
this.inputs.push('');
} else {
- this.value == null || this.value == undefined ? this.inputs.push('') : this.inputs.push(this.value);
+ this.field.value == null || this.field.value == undefined ? this.inputs.push('') : this.inputs.push(this.field.value);
}
},
+ extractFieldType(field_type) {
+ let parts = field_type.split('\\');
+ return 'tainacan-' + parts.pop().toLowerCase();
+ },
validateObject () {
return
[
- { required: this.required, message: this.message, trigger: 'blur' }
+ { required: this.field.field.required, message: this.message, trigger: 'blur' }
]
},
- getErrors(){
- try{
- return JSON.parse( this.errorsMsg );
- }catch(e){
- console.log('invalid json error');
- }
- return this.errorsMsg;
- },
addInput(){
this.inputs.push('');
this.changeValue();