1parasails.registerPage('invitelist', { 2 // â¦ââââ¦ââ¦ââ¦âââ⦠âââââ¦ââââââ¦ââââ 3 // âââââ â ââ ââ£â âââ â â â⣠â â⣠4 // â©ââââ© â© â©â© â©â©ââ âââ â© â© â© â© âââ 5 data: { 6 // Form data 7 formData: { /* ⦠*/ }, 8 9 // For tracking client-side validation errors in our form. 10 // > Has property set to `true` for each invalid property in `formData`. 11 formErrors: { /* ⦠*/ }, 12 13 // Form rules 14 formRules: { 15 }, 16 17 // Syncing / loading state 18 syncing: false, 19 20 // Server error state 21 cloudError: '', 22 23 // Success state when form has been submitted 24 cloudSuccess: false, 25 }, 26 // ⦠â¦âââââââââ⦠â¦âââ⦠âââ 27 // â ââ ⣠â⣠â ââ¦ââ â â⣠28 // â©âââ©â ââââââ â© ââââ©âââââ 29 beforeMount: async function() { 30 _.extend(this, window.SAILS_LOCALS); 31 }, 32 mounted: async function() { 33 //⦠34 $('#invites-table').DataTable( { 35 sDom: 'lrtp', 36 ordering: false, 37 lengthChange: false, 38 language: { 39 url: 'https://cdn.datatables.net/plug-ins/1.13.1/i18n/pt-BR.json' 40 }, 41 serverSide: true, 42 ajax: { 43 url: '/invite/invitetable', 44 type: 'POST' 45 }, 46 "columns": [ 47 { "data": "emailAddress", 48 "render": function ( data, type, row, meta ) { 49 return data 50 }}, 51 { "data": "createdAt", 52 "render": function ( data, type, row, meta ) { 53 return moment.unix(data/1000).format("DD/MM/YYYY, H:mm"); 54 }}, 55 { "data": "erase", 56 "render": function ( data, type, row, meta ) { 57 return `<button id="eraseBtn" class="btn btn-outline-danger" type="button" onclick="deleteInviteFn('`+data+`')"><i class="fa fa-trash"></i> Excluir</button>`; 58 }}, 59 ], 60 } ); 61 62 $('#users-table').DataTable( { 63 sDom: 'lrtp', 64 ordering: false, 65 lengthChange: false, 66 language: { 67 url: 'https://cdn.datatables.net/plug-ins/1.13.1/i18n/pt-BR.json' 68 }, 69 serverSide: true, 70 ajax: { 71 url: '/invite/usertable', 72 type: 'POST' 73 }, 74 "columns": [ 75 { "data": "emailAddress", 76 "render": function ( data, type, row, meta ) { 77 return data + ( row.accountOwner ? '<span class="badge badge-pill badge-warning" style="position: relative; top: -2px; margin-left: 10px;">Proprietário da conta</span>':'' ); 78 }}, 79 { "data": "createdAt", 80 "render": function ( data, type, row, meta ) { 81 return moment.unix(data/1000).format("DD/MM/YYYY, H:mm"); 82 }}, 83 { "data": "erase", 84 "render": function ( data, type, row, meta ) { 85 return !row.accountOwner ? `<button id="eraseBtn" class="btn btn-outline-danger" type="button" onclick="deleteUserFn('`+data+`')"><i class="fa fa-trash"></i> Excluir</button>` : ''; 86 }}, 87 ], 88 } ); 89 90 //$('button[class="btn btn-danger"]').click(function() { 91 // console.log( "You clicked a paragraph!" ); 92 //}); 93 94 }, 95 96 // â¦âââââ¦âââââ¦ââââââââââ¦ââ¦âââââââââ 97 // ââââ â â⣠â â¦ââ ââ£â â ââ âââââââ 98 // â©âââ â© ââââ©âââ© â©âââ â© â©âââââââââ 99 methods: { 100 101 inviteDialog: async function() { 102 Swal.fire({ 103 title: 'Cadastro de Usuário', 104 imageUrl: '/images/newuser.png', 105 imageWidth: 253, 106 imageHeight: 206, 107 html: `<label for="login">Endereço de e-mail do novo usuário</label><input style="margin-top: 0px;" type="text" id="login" class="swal2-input" value=""> 108 <label for="password">Senha provisória do novo usuário</label><input style="margin-top: 0px;" type="password" id="password" class="swal2-input value=""">`, 109 confirmButtonText: 'Cadastrar', 110 showCancelButton: true, 111 cancelButtonText: 'Cancelar', 112 focusConfirm: false, 113 preConfirm: async (r) => { 114 const login = Swal.getPopup().querySelector('#login').value 115 const password = Swal.getPopup().querySelector('#password').value 116 if (!login || !password || !this.isEmail(login)) { 117 Swal.showValidationMessage(`Por favor digite um e-mail válido e senha`) 118 } else { 119 try { 120 let response = await $.post("/invite/create", { emailAddress: login, password: password }); 121 } catch (error) { 122 console.log(error.responseText, typeof error.responseText) 123 if (error.responseText == `"emailAlreadyInUse"` || error.responseText == "emailAlreadyInUse") { 124 Swal.showValidationMessage(`Erro: email já em uso n
124a plataforma`); 125 } else { 126 Swal.showValidationMessage(`Erro: ${error.responseText}`); 127 } 128 } 129 }; 130 return { login: login, password: password } 131 } 132 }).then((r) => { 133 if (r.value) { 134 Swal.fire( 135 { 136 title: 'E-mail de convite enviado para o novo usuário.', 137 imageUrl: '/images/newuser.png', 138 imageWidth: 253, 139 imageHeight: 206, 140 html: `<p>ATENÃÃO: Ainda é necessário que ele aceite o convite clicando no link do email enviado.</p> 141 <p>E-mail: ${r.value.login}</p> 142 <p>Senha provisória: ${r.value.password}</p>`, 143 confirmButtonText: 'Ok', 144 }).then(()=>{ 145 location.reload(); 146 }) 147 } 148 }) 149 }, 150 151 isEmail: function (email) { 152 var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; 153 return regex.test(email); 154 } 155 156 } 157 });
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.