fix(ventas): add generateUid fallback for non-secure contexts (HTTP)
CI / Build Native (push) Successful in 6m46s
CI / Build Native (push) Successful in 6m46s
This commit is contained in:
@@ -1,4 +1,10 @@
|
|||||||
window.shots = {
|
window.shots = {
|
||||||
|
generateUid() {
|
||||||
|
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
|
||||||
|
return crypto.randomUUID();
|
||||||
|
}
|
||||||
|
return Date.now().toString(36) + '-' + Math.random().toString(36).slice(2, 10);
|
||||||
|
},
|
||||||
WEIGHTS: {
|
WEIGHTS: {
|
||||||
Soulshot: { D: 3, C: 3, B: 2, A: 2, S: 2 },
|
Soulshot: { D: 3, C: 3, B: 2, A: 2, S: 2 },
|
||||||
Spiritshot: { D: 5, C: 3, B: 3, A: 2, S: 2 },
|
Spiritshot: { D: 5, C: 3, B: 3, A: 2, S: 2 },
|
||||||
@@ -72,7 +78,7 @@ window.shots = {
|
|||||||
const grado = m[2].toUpperCase();
|
const grado = m[2].toUpperCase();
|
||||||
const cantidad = parseInt(m[3].replace(/[.,]/g, ''), 10);
|
const cantidad = parseInt(m[3].replace(/[.,]/g, ''), 10);
|
||||||
if (!this.WEIGHTS[tipo]?.[grado]) continue;
|
if (!this.WEIGHTS[tipo]?.[grado]) continue;
|
||||||
parsed.push({ uid: crypto.randomUUID(), tipo, grado, cantidad });
|
parsed.push({ uid: this.generateUid(), tipo, grado, cantidad });
|
||||||
}
|
}
|
||||||
return parsed;
|
return parsed;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -303,7 +303,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
addItem() {
|
addItem() {
|
||||||
this.form.items.push({ uid: crypto.randomUUID(), tipo: '', grado: '', cantidad: null });
|
this.form.items.push({ uid: window.shots.generateUid(), tipo: '', grado: '', cantidad: null });
|
||||||
},
|
},
|
||||||
|
|
||||||
removeItem(idx) {
|
removeItem(idx) {
|
||||||
|
|||||||
Reference in New Issue
Block a user