parent
ab80df92be
commit
6e3e61add6
|
@ -64,13 +64,15 @@
|
|||
<div class="form-group row">
|
||||
<label for="edit_event_search-searchbar" class="col-sm-3 col-form-label">Einsatzverantwortlich</label>
|
||||
<div class="col-sm-9">
|
||||
{{> search base="edit_event_search" type="member"}}
|
||||
{{search2 type="member" classname="search_member_responsible" value_id=member_responsible
|
||||
value=member_responsible_name}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="edit_event_organiser_search-searchbar" class="col-sm-3 col-form-label">Veranstalter</label>
|
||||
<div class="col-sm-9">
|
||||
{{> search base="edit_event_organiser_search" type="organiser"}}
|
||||
{{search2 type="organiser" classname="search_organiser" value_id=organiser_id
|
||||
value=organiser_name}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
|
|
|
@ -251,8 +251,11 @@ EventBilling = (function () {
|
|||
let eu_instances = {};
|
||||
let load_local_templates = async function () {
|
||||
const eu_instance_card = $.get("/templates/eb_eu_instance_card.hbs");
|
||||
await Promise.all([eu_instance_card]).then(function (res) {
|
||||
const new_position_instance = $.get("/templates/eb_eu_instance_card_new_position_instance.hbs");
|
||||
await Promise.all([eu_instance_card, new_position_instance]).then(function (res) {
|
||||
templates.eu_instance_card = Handlebars.compile(res[0]);
|
||||
templates.new_position_instance = Handlebars.compile(res[1]);
|
||||
Handlebars.registerPartial('new_position_instance', templates.new_position_instance);
|
||||
});
|
||||
};
|
||||
let setup = async function () {
|
||||
|
@ -275,7 +278,6 @@ EventBilling = (function () {
|
|||
}
|
||||
|
||||
$(".eu_instances_container").append(templates.eu_instance_card(instance));
|
||||
console.log(instance);
|
||||
|
||||
}
|
||||
|
||||
|
@ -285,16 +287,31 @@ EventBilling = (function () {
|
|||
|
||||
//Apply remove/restore position_instance button listeners
|
||||
$(".remove_position_instance_button").off("click").on("click", delete_position_btn);
|
||||
$(".remove_new_position_instance_button").off("click").on("click", function () {
|
||||
$(this).closest(".card").remove();
|
||||
});
|
||||
$(".restore_position_instance_button").off("click").on("click", restore_position_btn);
|
||||
|
||||
$(".approve_times_btn").off("click").on("click", approve_times);
|
||||
$(".qsf").off("change").on("change", function () { //Show save button if instance changed
|
||||
$(this).closest(".position_instance").addClass("modified");
|
||||
$(this).closest(".instance").find(".eb_eu_instance_save_btn").show();
|
||||
})
|
||||
});
|
||||
|
||||
let add_new_position_instance_listener = function(){
|
||||
$(this).closest(".new_position_instances").append(templates.new_position_instance);
|
||||
$(".new_position_instance").off("click");
|
||||
$(".new_position_instance:last-child").on("click", add_new_position_instance_listener);
|
||||
$(".remove_new_position_instance_button").off("click").on("click", function () {
|
||||
$(this).closest(".card").remove();
|
||||
$(".new_position_instance").off("click");
|
||||
$(".new_position_instance:last-child").on("click", add_new_position_instance_listener);
|
||||
});
|
||||
}
|
||||
|
||||
$(".new_position_instance:last-child").off("click").on("click", function(){
|
||||
add_new_position_instance_listener(this);
|
||||
});
|
||||
$(".remove_new_position_instance_button").off("click").on("click", function () {
|
||||
$(this).closest(".card").remove();
|
||||
});
|
||||
};
|
||||
let save = async function () {
|
||||
//TODO: use global save_pending_requests()
|
||||
|
@ -381,7 +398,8 @@ EventBilling = (function () {
|
|||
}
|
||||
if (!error_occured) {
|
||||
save_btn.hide();
|
||||
await setup();
|
||||
parent.find(".marked-for-delete").remove();
|
||||
parent.find(".modified").removeClass("modified");
|
||||
}
|
||||
}, function () {
|
||||
//Failure
|
||||
|
@ -442,7 +460,9 @@ EventBilling = (function () {
|
|||
}
|
||||
});
|
||||
if (is_ok(res)) {
|
||||
window.location.href = "/portal/eb/personnel_billing?event_id=" + event.entity_id;
|
||||
setTimeout(function(){
|
||||
window.location.href = "/portal/eb/personnel_billing?event_id=" + event.entity_id;
|
||||
}, 500);
|
||||
} else {
|
||||
throw res;
|
||||
}
|
||||
|
|
|
@ -162,6 +162,21 @@ Search2 = (function () {
|
|||
let res = res_map.get($(this).data("entity-id"));
|
||||
setValue(this, res.entity_id, res.identifier+" ("+res.numberplate+")");
|
||||
};
|
||||
}else if (type === "organiser") {
|
||||
options.url = "/api/event_organisers/";
|
||||
options.get_data = {
|
||||
"q": searchbar.val()
|
||||
};
|
||||
options.res_handler = function (data) {
|
||||
$.each(data.organisers, function (index, value) {
|
||||
res_map.set(value.entity_id, value);
|
||||
overlay_list.append("<span tabindex=\"0\" class=\"search2-result-overlay-list-entry\" data-entity-id=\"" + value.entity_id + "\"><li class='list-group-item'><span class=\"badge badge-secondary\">Hinzufügen:</span> " + value.company + " : "+value.firstname + " " + value.lastname +"</li></span>");
|
||||
});
|
||||
};
|
||||
options.overlay_click_handler = function () {
|
||||
let res = res_map.get($(this).data("entity-id"));
|
||||
setValue(this, res.entity_id, res.company+" "+res.firstname+" "+res.lastname);
|
||||
};
|
||||
}else {
|
||||
console.error("Unknown search type: " + type);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue