add edit button deal
This commit is contained in:
parent
01f1bb1358
commit
5d6a39bf85
@ -2297,4 +2297,17 @@ if($request == 'get_view_page'){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($request == 'get_deal_by_req'){
|
||||||
|
$req_id = intval($data->req_id);
|
||||||
|
$sql = "SELECT id FROM deals WHERE side_one_requisition_id = $req_id LIMIT 1";
|
||||||
|
$q = $pdo->query($sql);
|
||||||
|
$deal_id = null;
|
||||||
|
if($q && $pdo->num_rows($q) > 0){
|
||||||
|
$r = $pdo->fetch_assoc($q);
|
||||||
|
$deal_id = (int)$r['id'];
|
||||||
|
}
|
||||||
|
echo json_encode(['deal_id' => $deal_id]);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -1377,6 +1377,20 @@ var ac = new Vue({
|
|||||||
console.error('createDeal function not found');
|
console.error('createDeal function not found');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
initEditDeal(reqId) {
|
||||||
|
$.ajax({
|
||||||
|
url: '/ajax/ajax_vue_requisitions.php',
|
||||||
|
type: 'POST',
|
||||||
|
contentType: 'application/json',
|
||||||
|
data: JSON.stringify({ request: 'get_deal_by_req', req_id: reqId }),
|
||||||
|
success: function(response) {
|
||||||
|
var res = typeof response === 'string' ? JSON.parse(response) : response;
|
||||||
|
if (res.deal_id) {
|
||||||
|
window.editDeal(reqId, res.deal_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
|||||||
@ -5330,17 +5330,24 @@ $user_id = $_SESSION['id'];
|
|||||||
?>
|
?>
|
||||||
<div v-if="step.create_deal == 1 && currentPage.includes('/requisitions.php')" class="form-block">
|
<div v-if="step.create_deal == 1 && currentPage.includes('/requisitions.php')" class="form-block">
|
||||||
<template v-if="step.is_deal === 1">
|
<template v-if="step.is_deal === 1">
|
||||||
<div style="color: green; font-weight: bold;">Сделка успешно создана</div>
|
<div class="label">Сделка</div>
|
||||||
|
<button
|
||||||
|
style="color: #fff; padding: 10px 20px; background: linear-gradient(to bottom, rgba(67, 160, 71, 1) 0%, rgba(56, 142, 60, 1) 100%); border: none; font-family: 'Lato', sans-serif; font-size: 15px; border-radius: 3px; cursor: pointer;"
|
||||||
|
type="button"
|
||||||
|
@click="initEditDeal(reqId)">
|
||||||
|
Редактировать сделку
|
||||||
|
</button>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div class="label">Сделка</div>
|
<div class="label">Сделка</div>
|
||||||
<button
|
<div style="display: flex; justify-content: center;">
|
||||||
style="color: #fff; padding: 10px 20px; background: linear-gradient(to bottom, rgba(67, 160, 71, 1) 0%, rgba(56, 142, 60, 1) 100%); border: none; font-family: 'Lato', sans-serif; font-size: 15px;"
|
<button
|
||||||
type="button"
|
style="color: #fff; padding: 10px 20px; background: linear-gradient(to bottom, rgba(67, 160, 71, 1) 0%, rgba(56, 142, 60, 1) 100%); border: none; font-family: 'Lato', sans-serif; font-size: 15px; border-radius: 3px; cursor: pointer;"
|
||||||
id="createDealButton"
|
type="button"
|
||||||
@click="initCreateDeal(reqId)">
|
id="createDealButton"
|
||||||
Создать сделку
|
@click="initCreateDeal(reqId)">
|
||||||
</button>
|
Создать сделку
|
||||||
|
</button>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user