Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
queue
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cristian Mauricio Diaz Canales
queue
Commits
c378c7b0
Commit
c378c7b0
authored
Dec 23, 2022
by
Cristian Mauricio Diaz Canales
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correccion mes en ticket
Correccion Bug Rut
parent
15dc9da3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
6 deletions
+69
-6
app/Models/Queue.php
app/Models/Queue.php
+57
-2
resources/views/issue_token/index.blade.php
resources/views/issue_token/index.blade.php
+12
-4
No files found.
app/Models/Queue.php
View file @
c378c7b0
...
...
@@ -5,6 +5,7 @@ namespace App\Models;
use
Carbon\Carbon
;
use
Illuminate\Database\Eloquent\Factories\HasFactory
;
use
Illuminate\Database\Eloquent\Model
;
use
Symfony\Component\Translation\TranslatorInterface
;
class
Queue
extends
Model
{
...
...
@@ -20,8 +21,61 @@ class Queue extends Model
}
public
function
getFormatedDateAttribute
(
$value
){
$date
=
Carbon
::
parse
(
$this
->
created_at
)
->
format
(
'j-F-Y'
);
return
$date
;
$dateString
=
Carbon
::
parse
(
$this
->
created_at
)
->
format
(
'Y-m-d'
);
$format
=
'Y-m-d'
;
// input format
$date
=
Carbon
::
createFromFormat
(
$format
,
$dateString
);
$spanishMonths
=
[
'Enero'
,
'Febrero'
,
'Marzo'
,
'Abril'
,
'Mayo'
,
'Junio'
,
'Julio'
,
'Agosto'
,
'Septiembre'
,
'Octubre'
,
'Noviembre'
,
'Diciembre'
];
$year
=
explode
(
'-'
,
$dateString
)[
0
];
$month
=
explode
(
'-'
,
$dateString
)[
1
];
$day
=
explode
(
'-'
,
$dateString
)[
2
];
switch
(
$month
)
:
case
'01'
:
$mntStr
=
$spanishMonths
[
0
];
break
;
case
'02'
:
$mntStr
=
$spanishMonths
[
1
];
break
;
case
'03'
:
$mntStr
=
$spanishMonths
[
2
];
break
;
case
'04'
:
$mntStr
=
$spanishMonths
[
3
];
break
;
case
'05'
:
$mntStr
=
$spanishMonths
[
4
];
break
;
case
'06'
:
$mntStr
=
$spanishMonths
[
5
];
break
;
case
'07'
:
$mntStr
=
$spanishMonths
[
6
];
break
;
case
'08'
:
$mntStr
=
$spanishMonths
[
7
];
break
;
case
'09'
:
$mntStr
=
$spanishMonths
[
8
];
break
;
case
'10'
:
$mntStr
=
$spanishMonths
[
9
];
break
;
case
'11'
:
$mntStr
=
$spanishMonths
[
10
];
break
;
case
'12'
:
$mntStr
=
$spanishMonths
[
11
];
break
;
endswitch
;
return
$year
.
"-"
.
$mntStr
.
"-"
.
$day
;
}
public
function
call
(){
return
$this
->
hasOne
(
Call
::
class
);
...
...
@@ -30,4 +84,5 @@ class Queue extends Model
public
function
getTokenNumberAttribute
(){
return
$this
->
letter
.
'-'
.
$this
->
number
;
}
}
resources/views/issue_token/index.blade.php
View file @
c378c7b0
...
...
@@ -75,7 +75,7 @@
</div>
<div class="
input
-
field
col
-
lg
-
4
s4
" id="
rut_tab
">
<input id="
rut
" name="
rut
" type="
text
" value=""
oninput="
formatearRut
(
this
);
"
data-error="
.
rut
">
<input id="
rut
" name="
rut
" type="
text
" value=""
maxlength="
12
" oninput="
formatearRut
(
this
);
" maxlength=13
data-error="
.
rut
">
<label for="
rut
">
{
{__('messages.settings.rut')}
}
</label>
<div class="
rut
">
<span><b>Ingrese su rut para poder solicitar su número de atención</b></span>
...
...
@@ -91,7 +91,7 @@
<button onclick="
escribirValor
(
9
,
event
)
">9</button>
<button onclick="
escribirValor
(
-
2
,
event
)
">K</button>
<button onclick="
escribirValor
(
0
,
event
)
">0</button>
<button onclick="
escribirValor
(
-
1
,
event
)
">
Del
</button>
<button onclick="
escribirValor
(
-
1
,
event
)
">
Borrar
</button>
</div>
</div>
</div>
...
...
@@ -139,7 +139,9 @@
function
formatearRut
(
input
){
let
value
=
input
.
value
.
replace
(
/
\
./
g
,
''
)
.
replace
(
'-'
,
''
);
let
maxLength
=
12
;
if
(
value
.
length
>
maxLength
)
value
=
value
.
slice
(
0
,
maxLength
);
if
(
value
.
match
(
/^
(
\d
{
2
})(
\d
{
3
}){
2
}(
\w
{
1
})
$
/
))
{
value
=
value
.
replace
(
/^
(
\d
{
2
})(
\d
{
3
})(
\d
{
3
})(
\w
{
1
})
$
/
,
'$1.$2.$3-$4'
);
}
...
...
@@ -157,6 +159,8 @@
function
formatearRutPorValor
(
val
){
let
value
=
val
.
replace
(
/
\
./
g
,
''
)
.
replace
(
'-'
,
''
);
let
maxLength
=
12
;
if
(
value
.
length
>
maxLength
)
value
=
value
.
slice
(
0
,
maxLength
);
if
(
value
.
match
(
/^
(
\d
{
2
})(
\d
{
3
}){
2
}(
\w
{
1
})
$
/
))
{
value
=
value
.
replace
(
/^
(
\d
{
2
})(
\d
{
3
})(
\d
{
3
})(
\w
{
1
})
$
/
,
'$1.$2.$3-$4'
);
...
...
@@ -177,7 +181,9 @@
event
.
preventDefault
();
let
inputValue
=
$
(
"#rut"
)
.
val
();
if
(
number
==
-
1
){
inputValue
=
inputValue
.
slice
(
0
,
-
1
);
inputValue
=
$
(
"#rut"
)
.
val
(
""
);
$
(
"#rut"
)
.
focus
();
return
;
}
else
if
(
number
==
-
2
){
inputValue
=
inputValue
+
""
+
"K"
;
}
else
{
...
...
@@ -198,8 +204,10 @@
else
$
(
'#phone_tab'
)
.
hide
()
if
(
value
.
ask_rut
==
1
)
{
$
(
'#rut_tab'
)
.
show
();
$
(
'#rut_pad'
)
.
show
();
}
else
{
$
(
'#rut_tab'
)
.
hide
();
$
(
'#rut_pad'
)
.
hide
();
}
service
=
value
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment