add tab deal in client edit
This commit is contained in:
parent
b188bbe138
commit
76182895c6
60
js/deals_client_vue.js
Normal file
60
js/deals_client_vue.js
Normal file
@ -0,0 +1,60 @@
|
||||
Vue.config.devtools = true;
|
||||
|
||||
var deals_client = new Vue({
|
||||
el: '#deals_list_client',
|
||||
name: 'deals_list_client',
|
||||
data() {
|
||||
return {
|
||||
dealsList: [],
|
||||
isDealsClient: 0,
|
||||
clientId: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
if (this.clientId > 0) {
|
||||
this.dealsList = [];
|
||||
this.isDealsClient = 0;
|
||||
|
||||
axios.post('/ajax/ajax_vue_requisitions.php', {
|
||||
request: 'get_deal_by_client',
|
||||
client_id: this.clientId,
|
||||
})
|
||||
.then((response) => {
|
||||
var res = response.data;
|
||||
if (res.deals && res.deals.length > 0) {
|
||||
var promises = res.deals.map(dealId => {
|
||||
return axios.get('/api/deals/' + dealId).then(r => r.data.data).catch(() => null);
|
||||
});
|
||||
Promise.all(promises).then(results => {
|
||||
deals_client.dealsList = results.filter(d => d !== null);
|
||||
deals_client.isDealsClient = deals_client.dealsList.length > 0 ? 1 : 2;
|
||||
});
|
||||
} else {
|
||||
this.isDealsClient = 2;
|
||||
}
|
||||
})
|
||||
.catch(function(error) {
|
||||
console.log(error);
|
||||
deals_client.isDealsClient = 2;
|
||||
});
|
||||
}
|
||||
},
|
||||
openDealFromClient(dealId) {
|
||||
if (typeof window.editDeal === 'function') {
|
||||
window.editDeal(0, dealId);
|
||||
} else {
|
||||
console.error('editDeal not available');
|
||||
}
|
||||
},
|
||||
isEmpty(obj) {
|
||||
for (var key in obj) {
|
||||
if (obj.hasOwnProperty(key)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// Автоматически загружаем список при монтировании
|
||||
}
|
||||
});
|
||||
@ -1787,6 +1787,16 @@ $user_id = $_SESSION['id'];
|
||||
<i class="tabs-li__icon">6</i>
|
||||
<span>Для документов</span>
|
||||
</li>
|
||||
|
||||
<?php
|
||||
$allowed_users_deal = [18388];
|
||||
if (in_array((int)$_SESSION['id'], $allowed_users_deal)) {
|
||||
?>
|
||||
<li id="liDeals" data-page="7">
|
||||
<i class="tabs-li__icon">7</i>
|
||||
<span>Сделки</span>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<div>
|
||||
<div class="tabs__content">
|
||||
@ -3209,6 +3219,45 @@ $user_id = $_SESSION['id'];
|
||||
по эл. почте Вашему клиенту или просто вывести на печать.</span>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<!-- Сделки -->
|
||||
<div class="tabs__content">
|
||||
<div id="deals_list_client">
|
||||
<div v-show="isDealsClient===0" style="text-align:center; margin-top: 25px;">
|
||||
<img src="../images/rocket-spinner.svg" width="96px">
|
||||
</div>
|
||||
<div v-show="isDealsClient===1" class="clients">
|
||||
<div v-for="(item, index) in dealsList">
|
||||
<div class="client">
|
||||
<div class="client-inner">
|
||||
<div class="additional-info">
|
||||
<div class="type" style="font-weight:600;">{{ item.title }}</div>
|
||||
<div class="stagebar-title" style="color:#666;font-size:13px;">
|
||||
{{ item.side_one }} / {{ item.side_two }}
|
||||
</div>
|
||||
<div v-if="item.deal_date" style="font-size:12px;color:#999;">Дата: {{ item.deal_date }}</div>
|
||||
<div v-if="item.contract_price" style="font-size:12px;color:#999;">Сумма: {{ Number(item.contract_price).toLocaleString('ru-RU') }} руб.</div>
|
||||
</div>
|
||||
<div class="client-name">
|
||||
<h2><a href="javascript:{}" @click="openDealFromClient(item.id)" style="cursor:pointer;">{{ item.title }}</a></h2>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<a href="javascript:{};" class="no-border" title="Редактировать сделку" @click="openDealFromClient(item.id)">
|
||||
<span class="simple-button settings"><i class="jw-action-icon-settings"></i></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-show="isDealsClient===2" class="empty-block">
|
||||
<h1><i class="ti-na"></i></h1>
|
||||
<h2>Сделок не найдено</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -5331,23 +5380,22 @@ $user_id = $_SESSION['id'];
|
||||
<div v-if="step.create_deal == 1 && currentPage.includes('/requisitions.php')" class="form-block">
|
||||
<template v-if="step.is_deal === 1">
|
||||
<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>
|
||||
<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 v-else>
|
||||
<div class="label">Сделка</div>
|
||||
<div style="display: flex; justify-content: center;">
|
||||
<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"
|
||||
id="createDealButton"
|
||||
@click="initCreateDeal(reqId)">
|
||||
Создать сделку
|
||||
</button>
|
||||
<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;"
|
||||
type="button"
|
||||
id="createDealButton"
|
||||
@click="initCreateDeal(reqId)">
|
||||
Создать сделку
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
<?php } ?>
|
||||
@ -6071,6 +6119,7 @@ require($_SERVER['DOCUMENT_ROOT']."/templates/files_list.php");
|
||||
<script type="text/javascript" src="/js/crm_vue.js?v=<?=filemtime($_SERVER['DOCUMENT_ROOT'].'/js/crm_vue.js')?>"></script>
|
||||
<?php } ?>
|
||||
<script type="text/javascript" src="/js/requisitions_client_vue.js?v=<?=filemtime($_SERVER['DOCUMENT_ROOT'].'/js/requisitions_client_vue.js')?>"></script>
|
||||
<script type="text/javascript" src="/js/deals_client_vue.js?v=<?=filemtime($_SERVER['DOCUMENT_ROOT'].'/js/deals_client_vue.js')?>"></script>
|
||||
<script type="text/javascript" src="/js/requisitions_vue.js?v=<?=filemtime($_SERVER['DOCUMENT_ROOT'].'/js/requisitions_vue.js')?>"></script>
|
||||
<script type="text/javascript" src="/js/autosearch_vue.js?v=<?=filemtime($_SERVER['DOCUMENT_ROOT'].'/js/autosearch_vue.js')?>"></script>
|
||||
<script type="text/javascript" src="/js/requisitions.js?v=<?=filemtime($_SERVER['DOCUMENT_ROOT'].'/js/requisitions.js')?>"></script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user