Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .filter('daterangeentrevistado', function () {
- return function (conversations, start_date, end_date) {
- var result = [];
- //console.log(conversations, start_date, end_date);
- // date filters
- var start_date = start_date ? new Date(start_date.substring(start_date.length - 4, start_date.length) + "/" + start_date.substring(start_date.length - 7, start_date.length - 5) + "/" + start_date.substring(0, start_date.length == 10 ? 2 : 1)).getTime() : new Date("01/01/1900");
- var end_date = end_date ? new Date(end_date.substring(end_date.length - 4, end_date.length) + "/" + end_date.substring(end_date.length - 7, end_date.length - 5) + "/" + end_date.substring(0, end_date.length == 10 ? 2 : 1)).getTime() : new Date().getTime();
- //console.log(conversations, start_date, end_date);
- // if the conversations are loaded
- if (conversations && conversations.length > 0) {
- $.each(conversations, function (index, conversation) {
- //alert(conversation.datanascimento);
- //result.push(conversation);
- if (conversation.datanascimento) {
- var conversationDate = new Date(conversation.datanascimento.substring(conversation.datanascimento.length - 4, conversation.datanascimento.length) + "/" + conversation.datanascimento.substring(conversation.datanascimento.length - 7, conversation.datanascimento.length - 5) + "/" + conversation.datanascimento.substring(0, conversation.datanascimento.length == 10 ? 2 : 1)).getTime();
- //console.log('conversationDate',conversation.datanascimento, conversation.datanascimento.length, conversation.datanascimento.substring(conversation.datanascimento.length-4,conversation.datanascimento.length), conversation.datanascimento.substring(conversation.datanascimento.length-7,conversation.datanascimento.length-5) , conversation.datanascimento.substring(0,conversation.datanascimento.length==10?2:1), conversationDate, conversationDate >= start_date, conversationDate <= end_date);
- if (conversationDate >= start_date && conversationDate <= end_date) {
- //console.log('conversation', conversation);
- result.push(conversation);
- }
- }
- });
- return result;
- }
- };
- });
- <tr ng-repeat="entrevistado in results = (entrevistados.data | filter:query | daterangeentrevistado: datanascimentoInicio:datanascimentoFim)" id="filtros">
- <td><input type="checkbox" ng-model="entrevistado.selecionado" id="checkbox"> {{ entrevistado.rg }}</td>
- <td>{{ entrevistado.nome }}</td>
- <td>{{ entrevistado.telefone }}</td>
- <td>
- <div class="btn-group">
- <button class="btn btn-warning" ng-click="editData(entrevistado.rg)">
- <span class="glyphicon glyphicon-pencil"></span>
- </button>
- <button class="btn btn-danger" ng-click="removeData(entrevistado.id)">
- <span class="glyphicon glyphicon-remove"></span>
- </button>
- </div>
- </td>
- </tr>
Add Comment
Please, Sign In to add comment