personalannual.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. $(function()
  2. {
  3. $(document).on('click', '.addItem', function()
  4. {
  5. $(this).parents('tr').after('<tr>' + $(this).parents('tr').html() + '</tr>');
  6. $(this).parents('tr').next('tr').find('select,input').val('');
  7. $(this).parents('tr').next('tr').find('.chosen-container').remove();
  8. $(this).parents('tr').next('tr').find('select').show();
  9. $(this).parents('tr').next('tr').find('.chosen').chosen(window.chosenDefaultOptions);
  10. $(this).parents('tr').next('tr').find('.form-date').fixedDate().datetimepicker(
  11. {
  12. language: config.clientLang,
  13. weekStart: 1,
  14. todayBtn: 1,
  15. autoclose: 1,
  16. todayHighlight: 1,
  17. startView: 2,
  18. minView: 2,
  19. forceParse: 0,
  20. format: 'yyyy-mm-dd'
  21. });
  22. });
  23. $(document).on('click', '.delItem', function()
  24. {
  25. if($('.delItem').size() == 1)
  26. {
  27. $(this).parents('tr').find('input,select').val('');
  28. $(this).parents('tr').find('select').trigger('chosen:updated');
  29. return;
  30. }
  31. $(this).parents('tr').remove();
  32. });
  33. })