pg_rails 7.2.1 → 7.2.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2505003e224d063bd2c51742b431b315cef9e83b08c867adb0687f9184ad559
|
4
|
+
data.tar.gz: 0d3e3c74ef4c00f0e369302a592fccc0749ddb53c7143abd0be4dc1cf7da6418
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64ee127677a3f745bd0d29b8fac8150b03470d4cd03d6d6b37078168a3bfd43ac3332f085942bb9d0ea94b164fdd863f65df76c116f8e1ff708ebe012ac31348
|
7
|
+
data.tar.gz: 6cb3a28799ddd2a7c2fb621a1875b246b825355cd0e7b3a66925030138f46b0d81e1d5c0fa22ce29c4c5c747984145076af5a89085891112230ed34ebcd61732
|
@@ -13,6 +13,7 @@ export default class extends Controller {
|
|
13
13
|
|
14
14
|
today = yyyy + '-' + mm + '-' + dd
|
15
15
|
fechaEl.value = today
|
16
|
+
return fechaEl.value
|
16
17
|
}
|
17
18
|
|
18
19
|
closePopover () {
|
@@ -21,6 +22,12 @@ export default class extends Controller {
|
|
21
22
|
}
|
22
23
|
|
23
24
|
async submit () {
|
25
|
+
const fechaEl = document.getElementById(this.element.dataset.fieldId)
|
26
|
+
let startDate = fechaEl.value
|
27
|
+
if (!startDate) {
|
28
|
+
startDate = this.today()
|
29
|
+
}
|
30
|
+
|
24
31
|
const quantity = this.element.querySelector('input[name=quantity]').value
|
25
32
|
if (!quantity) {
|
26
33
|
this.closePopover()
|
@@ -28,8 +35,6 @@ export default class extends Controller {
|
|
28
35
|
}
|
29
36
|
const type = this.element.querySelector('select[name=type]').value
|
30
37
|
const direction = this.element.querySelector('select[name=direction]').value
|
31
|
-
const fechaEl = document.getElementById(this.element.dataset.fieldId)
|
32
|
-
const startDate = fechaEl.value
|
33
38
|
// console.log(quantity, type, direction)
|
34
39
|
this.element.querySelector('button').setAttribute('disabled', 'true')
|
35
40
|
// let input = this
|
@@ -43,18 +48,23 @@ export default class extends Controller {
|
|
43
48
|
responseKind: 'json'
|
44
49
|
})
|
45
50
|
|
51
|
+
let json = null
|
46
52
|
if (response.ok) {
|
47
|
-
|
53
|
+
json = await response.json
|
48
54
|
fechaEl.value = json.date
|
49
55
|
this.element.querySelector('button').removeAttribute('disabled')
|
50
56
|
this.closePopover()
|
51
57
|
} else {
|
52
|
-
|
53
|
-
|
54
|
-
|
58
|
+
let message = 'Hubo un error'
|
59
|
+
try {
|
60
|
+
json = await response.json
|
61
|
+
message = json.html || 'Hubo un error'
|
62
|
+
} catch (e) {
|
63
|
+
// JSON parser error
|
64
|
+
Rollbar.error(e)
|
65
|
+
}
|
55
66
|
flashMessage(message, 'warning', true)
|
56
67
|
this.element.querySelector('button').removeAttribute('disabled')
|
57
|
-
Rollbar.error('date jumper error', json)
|
58
68
|
}
|
59
69
|
}
|
60
70
|
}
|
data/pg_rails/lib/version.rb
CHANGED