personalsettings.js 1.1 KB

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