W tym artykule dowiesz się dodać głównemu administratorowi uprawnienie umożliwiające blokowanie i odblokowanie pracownika w Profilu Klienta w szablonie Szafir.
Pierwszym modyfikowanym plikiem będzie customer-profile/employees-list/employees-view-list.html. Cały kod w pliku należy usunąć a wkleić poniższy.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
{% for employee in customer-profile.Employees -%} <div class="customer-details-tile-ui customer-details-lq container-lq"> <div class="content-ui"> <div><strong>{{employee.Name}} {{employee.Name2}}</strong></div> <br> <div><i class="ti-email"></i> <span class="employee-email-lq">{{employee.Email}}</span></div> {% if employee.PhoneNo != '' -%} <div><i class="ti-headphone-alt"></i> {{employee.PhoneNo}}</div> {% endif -%} </div> <div class="buttons-ui"> <div class="edit-ui"> <div class="form-lq flr-ui form-into-data-lq"> <input type="hidden" name="id" value="{{employee.Id}}" /> <input type="hidden" name="__template" value="customer-profile/employees-list/employees-view-list.html" /> {% if employee.Active -%} <input type="hidden" name="__action" value="Customer/EmployeeLock" /> <button class="btn-pure-ui toggle-employee-lq" data-container=".employees-list-view-lq"> <i class="ti-lock"></i> <span class="icon-label-ui">{{ translations.Lock }}</span> </button> {% else-%} <input type="hidden" name="__action" value="Customer/EmployeeUnlock" /> <button class="btn-pure-ui toggle-employee-lq" data-container=".employees-list-view-lq"> <i class="ti-unlock"></i> <span class="icon-label-ui">{{ translations.Unlock }}</span> </button> {% endif -%} </div> </div> </div> </div> {% endfor -%} |
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
function toggleEmployee(e) { if(app.validationBeforePost(e) != 'error'){ var form = $(e.currentTarget).parents('.form-lq'); var data = form.find('input:not([disabled])').serializeArray(); data.push({name: "__csrf", value: __CSRF}); $.post('', data, function(result) { app.serverMessage(result, form, e); if (result.action.Result) { $('.employees-list-view-lq').html(result.template); } }); } }; $('body').on('click', '.toggle-employee-lq', function (e) { toggleEmployee(e); }); |