129
cancelCreate: function () {
this.$parent.cancelCreate();
}
},
mounted() {
let vm = this;
window.selectStart();
$('.clientFieldSelect2').on('select2:select', function(e){
vm.client_id = e.target.value;
});
},
}
</script>
<script>
export default {
props: ['buildings', 'types', 'operations'],
data: function () {
return {
operation_id: "",
type_id: "",
description: "",
description2: "",
client_id: "",
sq: "",
sq2: "",
count_room: [],
price: "",
floor: "",
floor_all: "",
address: "",
toEditId: 0
}
},
computed: {
renderBuildings: function () {
return this.buildings;
},
},
methods: {
startEdit: function (building) {
this.toEditId = building.id;
this.operation_id = building.operation_id;
this.type_id = building.building_type_id;
this.description = building.description;
this.description2 = building.description2;
this.client_id = building.client;
this.sq = building.sq;
this.sq2 = building.sq2;
this.count_room = building.count_room;
this.price = building.price;
this.floor = building.floor;
this.floor_all = building.floor_all;
this.address = building.address;
this.$nextTick(function(){
let option = new Option(building.client.f_name + ' ' +
building.client.l_name, building.client.id, true, true);
$('.clientFieldSelect2').append(option).trigger('change');
});
},
editBuilding: function () {
let vm = this;
vm.$validator.validateAll().then((result) => {
if (result) {
axios({
method: 'put',
url: '/buildings/' + vm.toEditId,
data: {
operation_id: vm.operation_id,
building_type_id: vm.type_id,