Changeset 2042 for trunk/workflow/js/orgchart/organization.js
- Timestamp:
- 02/22/10 16:23:36 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/workflow/js/orgchart/organization.js
r1279 r2042 169 169 if (data.length == 0) 170 170 { 171 displayArea.innerHTML += '<br/><br/><center><strong>Nenhum registro encontrado</strong></center>'; 171 //displayArea.innerHTML += '<br/><br/><center><strong>Nenhum registro encontrado</strong></center>'; 172 elem = document.createElement('div'); 173 elem.id = this.name.capitalize() + 'List'; 174 elem.innerHTML = '<br/><br/><center><strong>Nenhum registro encontrado</strong></center>'; 175 displayArea.appendChild(elem); 172 176 return true; 173 177 } … … 369 373 Object.extend(objTelephones, CadastroTelefone); 370 374 375 var CadastroSubstituto = 376 { 377 name: 'substitution', 378 required: new Array('organizacao_id', 'area_id', 'descricao', 'titular_funcionario_id', 'substituto_funcionario_id', 'data_inicio', 'data_fim'), 379 tableHeader: {'substituto_funcionario_id_desc': 'Nome', 'data_inicio': 'Data de início', 'data_fim': 'Data de término'}, 380 combo: {} 381 }; 382 var objSubstitution = new CadastroAjax(); 383 Object.extend(objSubstitution, CadastroSubstituto); 384 385 371 386 function createOrganizationLayout(organizationID, organizationDiv) 372 387 { … … 397 412 content += '<option onclick="loadAddEmployeeUI(' + organizationID + ');" class="lbOn">Funcionários</option>' 398 413 content += '<option onclick="loadAddTelephoneUI(' + organizationID + ');" class="lbOn">Telefones</option>' 414 content += '<option onclick="loadAddSubstitutionUI(' + organizationID + ');" class="lbOn">Substituições</option>' 399 415 content += '</select></li>'; 400 416 content += '<li><a><input type="text" name="search_term" id="search_term" onkeypress="if (((window.Event) ? event.which : event.keyCode) == 13) $(\'search_span_' + organizationID + '\').onclick(); return true;" /> <span id="search_span_' + organizationID + '" onclick="tmp = $$(\'div#orgchartAreas_' + organizationID + ' a.destaque\'); if (tmp[0]) tmp[0].removeClassName(\'destaque\'); searchEmployee(' + organizationID + ', $(\'orgchartEmployees_' + organizationID + '\')); return false;">busca</span></a></li>'; … … 745 761 content += ' <a href="javascript:void(0)" onclick="$(\'titular_funcionario_id\').value=\'\'; $(\'titular_funcionario_id_desc\').value=\'\'; return false;"><img border="0" width="16" height="16" src="workflow/templateFile.php?file=images/delete_user.png" /></a>'; 746 762 content += '</td></tr>'; 747 content += '<tr><td><label for="substituto_funcionario_id">Substituto</label></td><td>';748 content += '<input type="hidden" name="substituto_funcionario_id" id="substituto_funcionario_id" value="" />';749 content += '<input type="input" name="substituto_funcionario_id_desc" id="substituto_funcionario_id_desc" value="" readonly="true" size="40" />';750 content += '<a href="javascript:void(0)" onclick="openParticipants(\'substituto_funcionario_id\', \'uid=1&hidegroups=1\');"><img border="0" width="16" height="16" src="workflow/templateFile.php?file=images/add_user.png" /></a>';751 content += ' <a href="javascript:void(0)" onclick="$(\'substituto_funcionario_id\').value=\'\'; $(\'substituto_funcionario_id_desc\').value=\'\'; return false;"><img border="0" width="16" height="16" src="workflow/templateFile.php?file=images/delete_user.png" /></a>';752 content += '</td></tr>';753 763 content += '<tr><td><label for="auxiliar_funcionario_id">Auxiliar Administrativo</label></td><td>'; 754 764 content += '<input type="hidden" name="auxiliar_funcionario_id" id="auxiliar_funcionario_id" value="" />'; … … 808 818 } 809 819 820 821 function loadAddSubstitutionUI(organizationID) 822 { 823 var area_id = 'combo_area'; 824 var content; 825 826 content = '<h2 id="modalTitle">Adicionar Substituição</h2>'; 827 content += '<form name="orgchartForm" id="orgchartForm">'; 828 content += '<input type="hidden" name="organizacao_id" id="organizacao_id" value="' + organizationID + '" />'; 829 content += "<table>"; 830 content += '<tr><td><label for="area_id">Sigla</label>'; 831 content += '<input type="hidden" name="area_id" id="area_id" value="" />'; 832 content += '</td><td id="comboArea"><i>carregando</i></td></tr>'; 833 content += '<tr><td><label for="descricao">Nome</label></td><td><input type="text" name="descricao" id="descricao" readonly="true" size="40" /></td></tr>'; 834 content += '<tr><td><label for="titular_funcionario_id">Titular</label></td><td>'; 835 content += '<input type="hidden" name="titular_funcionario_id" id="titular_funcionario_id" value="" readonly="true" />'; 836 content += '<input type="input" name="titular_funcionario_id_desc" id="titular_funcionario_id_desc" value="" readonly="true" size="40" />'; 837 content += '</td></tr>'; 838 content += '<tr><td><label for="substituto_funcionario_id">Substituto</label></td><td>'; 839 content += '<input type="hidden" name="substituto_funcionario_id" id="substituto_funcionario_id" value="" />'; 840 content += '<input type="input" name="substituto_funcionario_id_desc" id="substituto_funcionario_id_desc" value="" readonly="true" size="40" />'; 841 content += '<a href="javascript:void(0)" onclick="openParticipants(\'substituto_funcionario_id\', \'uid=1&hidegroups=1\');"><img border="0" width="16" height="16" src="workflow/templateFile.php?file=images/add_user.png" /></a>'; 842 content += ' <a href="javascript:void(0)" onclick="$(\'substituto_funcionario_id\').value=\'\'; $(\'substituto_funcionario_id_desc\').value=\'\'; return false;"><img border="0" width="16" height="16" src="workflow/templateFile.php?file=images/delete_user.png" /></a>'; 843 content += '</td></tr>'; 844 content += '<tr><td><label for="data_inicio">Data de início</label></td><td><input type="text" name="data_inicio" id="data_inicio" size="15" onkeypress="return formatDateField(event, this);" /></td></tr>'; 845 content += '<tr><td><label for="data_fim">Data de término</label></td><td><input type="text" name="data_fim" id="data_fim" size="15" onkeypress="return formatDateField(event, this);"/></td></tr>'; 846 content += "</table>"; 847 content += '</form>'; 848 content += '<button id="inserir" onclick="objSubstitution.add(); return false;">Inserir</button>'; 849 content += '<button onclick="valid.deactivate(); return false;">Cancelar</button>'; 850 851 var divLB = $('lbContent'); 852 divLB.innerHTML = content; 853 854 // function that must be called after loading areas on the combobox 855 var areas_callback = function () { 856 857 // every change on the combo box must query for area information 858 $(area_id).onchange = function () { 859 if ($('SubstitutionList')) 860 $('SubstitutionList').remove(); 861 862 var info_callback = function (data) { 863 864 // just to be sure 865 if (!data[0]) { 866 alert("Não foi possível encontrar os dados."); 867 } 868 869 // we received an empty response. Let's reset the form. 870 if ((data[0]['area_id'] == '') || (data[0]['area_id'] == null)) { 871 alert('RESET'); 872 $('area_id').value = ''; 873 $('descricao').value = ''; 874 $('titular_funcionario_id').value = ''; 875 $('titular_funcionario_id_desc').value = ''; 876 } 877 // fill the form 878 else { 879 $('area_id').value = data[0]['area_id']; 880 $('descricao').value = data[0]['descricao']; 881 $('titular_funcionario_id').value = data[0]['titular_funcionario_id']; 882 $('titular_funcionario_id_desc').value = data[0]['titular_funcionario_id_desc']; 883 } 884 885 // get the list of substitutions 886 objSubstitution.generateUpdateTable({'organization_id': organizationID, 'area_id': $(area_id).value}, divLB); 887 } 888 objArea.list(info_callback, {'organizacao_id': organizationID, 'area_id': $(area_id).value}); 889 890 } 891 } 892 objArea.generateComboBox({'organizacao_id': organizationID}, $('comboArea'), true, area_id, areas_callback); 893 } 894 810 895 function getEmployeeInfoTimer(e, employeeID, organizationID) 811 896 {
Note: See TracChangeset
for help on using the changeset viewer.