151 lines
5.1 KiB
PHP
151 lines
5.1 KiB
PHP
<div class="row">
|
|
|
|
<div class="col-lg-8">
|
|
<!-- Media library -->
|
|
<div class="panel panel-white">
|
|
<form class="search-block" action="/Descision/personaltyname/" method="GET" autocomplete="off">
|
|
<div class="search-block-item">
|
|
<div class="form-group">
|
|
<label for="dkey">Dkey</label>
|
|
<input type="search" class="form-control" id="dkey" name="dkey" value='<?= isset($dkey) ? $dkey : '' ?>'>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="search_text">Status</label>
|
|
<?= $card_status ?>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="title">Description</label>
|
|
<input type="search" class="form-control" id="description" name="description" value='<?= isset($description) ? $description : '' ?>'>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="search_text">Personality</label>
|
|
<input type="search" class="form-control" id="personality" name="personality" value='<?= isset($personality) ? $personality : '' ?>'>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="from_offer">Offers</label>
|
|
<div class="search-by-weight">
|
|
<input type="search" class="form-control" id="from_offer" name="from_offer" value='<?= isset($from_offer) ? $from_offer : '' ?>'>
|
|
|
|
<input type="search" class="form-control" id="to_offer" name="to_offer" value='<?= isset($to_offer) ? $to_offer : '' ?>'>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<button class="btn btn-primary btn-search" type="submit">Search</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<?= $link ?>
|
|
<div class="panel panel-white">
|
|
<?= $pers_table ?>
|
|
</div>
|
|
<!-- /media library -->
|
|
</div>
|
|
|
|
<div class="col-lg-4">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
let input_changed_map = new Map();
|
|
|
|
$(document).ready(function() {
|
|
$('input[id^=ofc]').on('change', function(event) {
|
|
event.preventDefault();
|
|
|
|
const id = $(this).closest('tr').find('td:eq(2)').html();
|
|
!input_changed_map.has(id) ?
|
|
input_changed_map.set(id, ['offers']) :
|
|
input_changed_map.get(id).indexOf('offers') === -1 ?
|
|
input_changed_map.set(id, ['offers', ...input_changed_map.get(id)]) :
|
|
null;
|
|
})
|
|
|
|
$('input[id^=txt]').on('change', function(event) {
|
|
event.preventDefault();
|
|
|
|
const id = $(this).closest('tr').find('td:eq(2)').html();
|
|
!input_changed_map.has(id) ?
|
|
input_changed_map.set(id, ['personality']) :
|
|
input_changed_map.get(id).indexOf('personality') === -1 ?
|
|
input_changed_map.set(id, ['personality', ...input_changed_map.get(id)]) :
|
|
null;
|
|
})
|
|
})
|
|
|
|
function updatePersonaltyName(id, dkey) {
|
|
// alert(card_id);
|
|
let message = '';
|
|
const input_changed = input_changed_map.get(dkey);
|
|
|
|
if (input_changed === undefined) {
|
|
return false;
|
|
}
|
|
|
|
const input_changed_length = input_changed.length;
|
|
|
|
if (input_changed_length === 2) {
|
|
|
|
message = "Continue saving prsonality text and offers ? ";
|
|
|
|
} else if (input_changed.indexOf('personality') !== -1) {
|
|
|
|
message = "Continue saving prsonality text ?";
|
|
|
|
} else if (input_changed.indexOf('offers') !== -1) {
|
|
|
|
message = "Continue saving offers ?";
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
var result = confirm(message);
|
|
if (result) {
|
|
//alert(110);
|
|
|
|
var pers_text = "txt" + dkey;
|
|
var pers_text_value = document.getElementById(pers_text).value;
|
|
|
|
var pers_offers = "ofc" + dkey;
|
|
var pers_offers_value = document.getElementById(pers_offers).value;
|
|
|
|
alert(pers_text_value + ' ' + pers_offers_value);
|
|
|
|
//Logic to delete the item
|
|
$.ajax({
|
|
url: "/descision/updatePersonaltyName?id=" + id + "&pers_text=" + pers_text_value + "&dkey=" + dkey + "&pers_offers=" + pers_offers_value
|
|
}).done(function(data) {
|
|
$('#pres' + dkey).html(data);
|
|
input_changed_map.get(dkey).length = 0;
|
|
//alert(data);
|
|
});
|
|
|
|
}
|
|
return false;
|
|
}
|
|
|
|
//initMap();
|
|
// -->
|
|
</script>
|
|
|
|
<style>
|
|
.search-block-item {
|
|
display: flex;
|
|
justify-content: space-around;
|
|
align-items: flex-end;
|
|
}
|
|
|
|
.search-block-item .form-group {
|
|
flex-basis: 100px;
|
|
}
|
|
|
|
.search-by-weight {
|
|
display: flex;
|
|
flex-direction: row;
|
|
}
|
|
</style>
|