Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
backend-mcafee
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
backend-mcafee
Commits
6fc59789
Commit
6fc59789
authored
Oct 21, 2020
by
Cristian Mauricio Diaz Canales
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#6 se agregan clases y logica de url terminos y condiciones en front
generado
parent
5650cae9
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
148 additions
and
36 deletions
+148
-36
app/Resources/views/backend_content/pages/campanias/nuevaCampania.html.twig
...s/backend_content/pages/campanias/nuevaCampania.html.twig
+22
-34
app/Resources/views/front/campania/prueba.html.twig
app/Resources/views/front/campania/prueba.html.twig
+5
-0
src/AppBundle/Model/map/CampaniaTableMap.php
src/AppBundle/Model/map/CampaniaTableMap.php
+17
-0
src/AppBundle/Model/om/BaseCampania.php
src/AppBundle/Model/om/BaseCampania.php
+25
-0
src/AppBundle/Model/om/BaseCampaniaQuery.php
src/AppBundle/Model/om/BaseCampaniaQuery.php
+65
-0
src/CampaniaBundle/Controller/CampaniaController.php
src/CampaniaBundle/Controller/CampaniaController.php
+14
-2
No files found.
app/Resources/views/backend_content/pages/campanias/nuevaCampania.html.twig
View file @
6fc59789
...
...
@@ -501,9 +501,6 @@
$
(
"
#mesaje-error-editar
"
).
hide
();
}
function
updateSelectorFila
(
formData
)
{
var
url
=
"
{{
path
(
'campania_recargar_fila_selector'
)
}}
"
;
$
.
ajax
...
...
@@ -523,7 +520,6 @@
});
}
function
updateSelectorFilaEditar
(
formData
)
{
var
url
=
"
{{
path
(
'campania_recargar_fila_selector'
)
}}
"
;
$
.
ajax
...
...
@@ -690,7 +686,6 @@
});
}
function
saveContenidoBDEditar
(
json
,
conId
)
{
var
formData
=
new
FormData
();
var
url
=
"
{{
path
(
'campania_update_contenido'
)
}}
"
;
...
...
@@ -801,7 +796,6 @@
});
}
function
saveContenidoJson
(
event
)
{
event
.
preventDefault
();
var
seccion
=
$
(
"
#generador-contenido-selector-seccion
"
).
val
();
...
...
@@ -901,7 +895,6 @@
}
function
eliminarContenido
(
event
,
conId
)
{
event
.
preventDefault
();
var
r
=
confirm
(
"
Está seguro que desea eliminar este contenido de la campaña?
"
);
...
...
@@ -976,7 +969,6 @@
}
function
guardarCampania
(
event
)
{
event
.
preventDefault
();
var
url
=
"
{{
path
(
'campania_actualizar_con_contenido'
)
}}
"
;
...
...
@@ -987,7 +979,7 @@
formData
.
append
(
"
campaniaTitulo
"
,
$
(
"
#campania_titulo
"
).
val
());
formData
.
append
(
"
campaniaAdWords
"
,
$
(
"
#campania_id_adwords
"
).
val
());
formData
.
append
(
"
campaniaPixel
"
,
$
(
"
#campania_id_pixel_facebook
"
).
val
());
formData
.
append
(
"
campania
UrlTerminosCondicione
s
"
,
$
(
"
#campania_terminos
"
).
val
());
formData
.
append
(
"
campania
Termino
s
"
,
$
(
"
#campania_terminos
"
).
val
());
formData
.
append
(
"
fechaInicio
"
,
$
(
'
#campania_fecha_vigencia
'
).
data
(
'
daterangepicker
'
).
startDate
.
format
(
'
YYYY-MM-DD
'
));
formData
.
append
(
"
fechaFin
"
,
$
(
'
#campania_fecha_vigencia
'
).
data
(
'
daterangepicker
'
).
endDate
.
format
(
'
YYYY-MM-DD
'
));
formData
.
append
(
"
jsonContenido
"
,
JSON
.
stringify
(
jsonContenidoCampania
));
...
...
@@ -1038,6 +1030,27 @@
});
}
function
urlCopy
(
event
)
{
event
.
preventDefault
();
$
(
"
#msg-copiado-url
"
).
show
();
$
(
"
#msg-copiado-url
"
).
html
(
"
Copiando url...
"
);
$
(
"
#url_campania
"
).
prop
(
"
disabled
"
,
false
);
$
(
"
#url_campania
"
).
select
();
document
.
execCommand
(
'
copy
'
);
$
(
"
#msg-copiado-url
"
).
show
();
$
(
"
#msg-copiado-url
"
).
html
(
"
Copiado!
"
);
$
(
"
#url_campania
"
).
prop
(
"
disabled
"
,
true
);
}
function
urlPreview
(
event
){
event
.
preventDefault
();
window
.
open
(
$
(
"
#url_campania
"
).
val
(),
'
_blank
'
);
}
/**
* CARGA DEL DOCUMENTO
*
*/
/**
* DECLARACION LISTENERS
...
...
@@ -1144,37 +1157,12 @@
});
function
urlCopy
(
event
)
{
event
.
preventDefault
();
$
(
"
#msg-copiado-url
"
).
show
();
$
(
"
#msg-copiado-url
"
).
html
(
"
Copiando url...
"
);
$
(
"
#url_campania
"
).
prop
(
"
disabled
"
,
false
);
$
(
"
#url_campania
"
).
select
();
document
.
execCommand
(
'
copy
'
);
$
(
"
#msg-copiado-url
"
).
show
();
$
(
"
#msg-copiado-url
"
).
html
(
"
Copiado!
"
);
$
(
"
#url_campania
"
).
prop
(
"
disabled
"
,
true
);
}
function
urlPreview
(
event
){
event
.
preventDefault
();
window
.
open
(
$
(
"
#url_campania
"
).
val
(),
'
_blank
'
);
}
/**
* CARGA DEL DOCUMENTO
*
*/
jQuery
(
document
).
ready
(
function
()
{
calendariosContainer
.
init
();
generateTable
();
});
</script>
{%
endblock
%}
app/Resources/views/front/campania/prueba.html.twig
View file @
6fc59789
...
...
@@ -26,5 +26,10 @@
{{
contenido.contenido
|
raw
}}
{%
endfor
%}
</div>
<div
id=
"terminosContainer"
>
{%
for
contenido
in
terminosCondiciones
%}
{{
contenido.contenido
|
raw
}}
{%
endfor
%}
</div>
</body>
</html>
src/AppBundle/Model/map/CampaniaTableMap.php
View file @
6fc59789
...
...
@@ -76,4 +76,21 @@ class CampaniaTableMap extends TableMap
$this
->
addRelation
(
'Fila'
,
'AppBundle\\Model\\Fila'
,
RelationMap
::
ONE_TO_MANY
,
array
(
'cam_id'
=>
'cam_id'
,
),
null
,
null
,
'Filas'
);
}
// buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public
function
getBehaviors
()
{
return
array
(
'timestampable'
=>
array
(
'create_column'
=>
'created_at'
,
'update_column'
=>
'updated_at'
,
'disable_updated_at'
=>
'false'
,
),
);
}
// getBehaviors()
}
// CampaniaTableMap
src/AppBundle/Model/om/BaseCampania.php
View file @
6fc59789
...
...
@@ -1177,8 +1177,19 @@ abstract class BaseCampania extends BaseObject implements Persistent
$ret
=
$this
->
preSave
(
$con
);
if
(
$isInsert
)
{
$ret
=
$ret
&&
$this
->
preInsert
(
$con
);
// timestampable behavior
if
(
!
$this
->
isColumnModified
(
CampaniaPeer
::
CREATED_AT
))
{
$this
->
setCreatedAt
(
time
());
}
if
(
!
$this
->
isColumnModified
(
CampaniaPeer
::
UPDATED_AT
))
{
$this
->
setUpdatedAt
(
time
());
}
}
else
{
$ret
=
$ret
&&
$this
->
preUpdate
(
$con
);
// timestampable behavior
if
(
$this
->
isModified
()
&&
!
$this
->
isColumnModified
(
CampaniaPeer
::
UPDATED_AT
))
{
$this
->
setUpdatedAt
(
time
());
}
}
if
(
$ret
)
{
$affectedRows
=
$this
->
doSave
(
$con
);
...
...
@@ -2935,4 +2946,18 @@ abstract class BaseCampania extends BaseObject implements Persistent
return
$this
->
alreadyInSave
;
}
// timestampable behavior
/**
* Mark the current object so that the update date doesn't get updated during next save
*
* @return Campania The current object (for fluent API support)
*/
public
function
keepUpdateDateUnchanged
()
{
$this
->
modifiedColumns
[]
=
CampaniaPeer
::
UPDATED_AT
;
return
$this
;
}
}
src/AppBundle/Model/om/BaseCampaniaQuery.php
View file @
6fc59789
...
...
@@ -1417,4 +1417,69 @@ abstract class BaseCampaniaQuery extends ModelCriteria
return
$this
;
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return CampaniaQuery The current query, for fluid interface
*/
public
function
recentlyUpdated
(
$nbDays
=
7
)
{
return
$this
->
addUsingAlias
(
CampaniaPeer
::
UPDATED_AT
,
time
()
-
$nbDays
*
24
*
60
*
60
,
Criteria
::
GREATER_EQUAL
);
}
/**
* Order by update date desc
*
* @return CampaniaQuery The current query, for fluid interface
*/
public
function
lastUpdatedFirst
()
{
return
$this
->
addDescendingOrderByColumn
(
CampaniaPeer
::
UPDATED_AT
);
}
/**
* Order by update date asc
*
* @return CampaniaQuery The current query, for fluid interface
*/
public
function
firstUpdatedFirst
()
{
return
$this
->
addAscendingOrderByColumn
(
CampaniaPeer
::
UPDATED_AT
);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return CampaniaQuery The current query, for fluid interface
*/
public
function
recentlyCreated
(
$nbDays
=
7
)
{
return
$this
->
addUsingAlias
(
CampaniaPeer
::
CREATED_AT
,
time
()
-
$nbDays
*
24
*
60
*
60
,
Criteria
::
GREATER_EQUAL
);
}
/**
* Order by create date desc
*
* @return CampaniaQuery The current query, for fluid interface
*/
public
function
lastCreatedFirst
()
{
return
$this
->
addDescendingOrderByColumn
(
CampaniaPeer
::
CREATED_AT
);
}
/**
* Order by create date asc
*
* @return CampaniaQuery The current query, for fluid interface
*/
public
function
firstCreatedFirst
()
{
return
$this
->
addAscendingOrderByColumn
(
CampaniaPeer
::
CREATED_AT
);
}
}
src/CampaniaBundle/Controller/CampaniaController.php
View file @
6fc59789
...
...
@@ -77,11 +77,15 @@ class CampaniaController extends Controller {
$campaniaTitulo
=
$request
->
get
(
"campaniaTitulo"
,
null
);
$campaniaAdWords
=
$request
->
get
(
"campaniaAdWords"
,
null
);
$campaniaFacebook
=
$request
->
get
(
"campaniaPixel"
,
null
);
$campaniaTerminos
=
$request
->
get
(
"campaniaTerminos"
,
null
);
$fechaInicio
=
$request
->
get
(
"fechaInicio"
,
null
);
$fechaFin
=
$request
->
get
(
"fechaFin"
,
null
);
$jsonContenido
=
$request
->
get
(
"jsonContenido"
,
null
);
$jResponse
=
new
JsonResponse
();
$log
->
debug
(
"campania id :
$campaniaId
|| template id :
$templateId
||campania nombre :
$campaniaNombre
|| campania titulo :
$campaniaTitulo
|| campania ad words :
$campaniaAdWords
|| campania facebook :
$campaniaFacebook
|| fecha inicio :
$fechaInicio
|| jsoncontenido :
$jsonContenido
"
);
$log
->
debug
(
"campania id :
$campaniaId
|| template id :
$templateId
||campania nombre :
$campaniaNombre
|| campania titulo :
$campaniaTitulo
|| campania ad words :
$campaniaAdWords
|| campania facebook :
$campaniaFacebook
|| campania terminos y condiciones :
$campaniaTerminos
|| fecha inicio :
$fechaInicio
|| jsoncontenido :
$jsonContenido
"
);
if
(
$campaniaId
==
null
||
$campaniaId
==
""
)
{
$log
->
debug
(
"la camapaña no existe..."
);
...
...
@@ -111,6 +115,13 @@ class CampaniaController extends Controller {
return
$jResponse
;
}
if
(
$campaniaTerminos
==
null
||
$campaniaTerminos
==
""
){
$log
->
debug
(
"el link de terminos y condiciones no puede estar vacio..."
);
$jResponse
->
setStatusCode
(
JsonResponse
::
HTTP_BAD_REQUEST
,
'- URL CONDITIONS EMPTY OR INVALID'
);
$jResponse
->
setData
(
array
(
"msg"
=>
"Debe ingresar un link de terminos y condiciones."
));
return
$jResponse
;
}
$log
->
debug
(
"generando la camapaña..."
);
$campania
=
CampaniaQuery
::
create
()
->
findPk
(
$campaniaId
);
...
...
@@ -125,6 +136,7 @@ class CampaniaController extends Controller {
$campania
->
setCamAdwords
(
$campaniaAdWords
);
$campania
->
setCamJsonEstructura
(
$jsonContenido
);
$campania
->
setCamUniqueKey
(
uniqid
(
"str_"
.
$campania
->
getCamId
()
.
"_"
));
$campania
->
setCamUrlTerminosCondicionesCampania
(
$campaniaTerminos
);
$campania
->
setOpeId
(
self
::
DEFAULT_OPERATOR
);
$campania
->
setSerId
(
self
::
DEFAULT_SERVICE
);
$campania
->
save
();
...
...
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