window.componentes = window.componentes || {};
const ProductCard = {
template: `
{{info.name ?? 'Product Name'}}
`,
data() {
return {
data:{ ...{}},
brick:{
id:"ProductCard",
name:"Product Card",
description:"",
}
};
},
props: {
admin:{
type: Boolean,
default: true
},
binds: {
type: Object,
default: () => {}
},
received_values: {
type: Object,
default: () => {}
},
...{
info:Object,
required:false,
default:()=>{}
} },
watch: {},
methods: {Move(id){
this.$hash('view',id)
if(this.$root.url.hash=='view'){
window.location.reload()
}
}},
mounted(){},
created(){},
};
window.componentes.ProductCard = ProductCard;
const RechargeTotal = {
template: `
{{received_values.amount ?? 0}} {{$root.settings.APP_DATA.config.currency}}
{{(received_values.amount??0)*$root.settings.APP_DATA.config.currency_tax}} {{$root.settings.APP_DATA.config.currency_alt}}
Total Amount Payable
{{received_values}}
`,
data() {
return {
data:{ ...{}},
brick:{
id:"RechargeTotal",
name:"Total Amount",
description:"Display the total amount",
}
};
},
props: {
admin:{
type: Boolean,
default: true
},
binds: {
type: Object,
default: () => {}
},
received_values: {
type: Object,
default: () => {}
},
...{} },
watch: {received_values: {
handler(newValue, oldValue) {
this.$emit('send-value','tax',parseFloat(this.$root.settings.APP_DATA.config.currency_tax).toFixed(2)??0)
},
immediate: true, // Ejecutar inmediatamente
deep: false
}},
methods: {},
mounted(){},
created(){},
};
window.componentes.RechargeTotal = RechargeTotal;
const SimilarProducts = {
template: `
`,
data() {
return {
data:{ ...{
data:[]
}},
brick:{
id:"SimilarProducts",
name:"Productos Similares",
description:"",
}
};
},
props: {
admin:{
type: Boolean,
default: true
},
binds: {
type: Object,
default: () => {}
},
received_values: {
type: Object,
default: () => {}
},
...{
filter:{
type:Object,
required:false,
default:()=>{}
}
} },
watch: {},
methods: {async getSimilar(){
const promise = await apiAppProducts.getAll(this.binds)
if(promise.data.error==false){
this.data = promise.data.data
} else {
this.$toast_validation("No se pudo obtener los productos similares",promise.data.data)
}
}},
mounted(){this.getSimilar()},
created(){},
};
window.componentes.SimilarProducts = SimilarProducts;
const TestData = {
template: `
Filtrar por Marca
{{item.name}}
Limpiar
`,
data() {
return {
data:{ ...{
data:[]
}},
brick:{
id:"TestData",
name:"Test",
description:"",
}
};
},
props: {
admin:{
type: Boolean,
default: true
},
binds: {
type: Object,
default: () => {}
},
received_values: {
type: Object,
default: () => {}
},
...{} },
watch: {},
methods: {async getData(){
const promise = await apiAppProductBrands.getAll()
this.data = promise.data
},
pushParams(k,v){
const params = new URLSearchParams(window.location.search)
params.set(k,v)
const new_params = (params?'?':'')+params.toString()
const base_url = window.location.hash+(this.$root.url.param??'')
const newUrl = window.location.pathname+new_params+base_url
history.replaceState({},"",newUrl)
this.$emit('send-value',k,v)
}},
mounted(){this.getData()},
created(){},
};
window.componentes.TestData = TestData;