(function( $, unitsData ) {
'use strict';
window.JetABAFUnits = new Vue( {
el: '#jet_abaf_apartment_units',
template: '#jet-abaf-units-manager',
data: {
loading: false,
loaded: false,
unitsList: [],
newUnitsNum: 1,
newUnitsTitle: '',
insertingUnits: false,
unitToDelete: null,
unitToEdit: null,
savingUnits: false,
deletingUnits: false,
},
methods: {
loadUnits: function() {
let self = this;
self.loading = true;
wp.apiFetch( {
method: 'get',
url: unitsData.get_units,
} ).then( function( response ) {
self.loading = false;
if ( response.success ) {
self.loaded = true;
self.unitsList = response.data.units;
}
} ).catch( function( e ) {
self.loading = false;
alert( e.message );
} );
},
saveUnit: function() {
var self = this;
self.savingUnits = true;
wp.apiFetch( {
method: 'post',
url: unitsData.update_unit,
data: {
apartment: unitsData.apartment,
unit: self.unitToEdit,
nonce: unitsData.nonce
}
} ).then( function( response ) {
self.deletingUnits = false;
if ( response.success ) {
self.unitsList = response.data.units;
self.unitToEdit = null;
}
} ).catch( function( e ) {
self.deletingUnits = false;
alert( e.message );
} );
},
deleteUnit: function() {
var self = this;
self.deletingUnits = true;
wp.apiFetch( {
method: 'post',
url: unitsData.delete_unit,
data: {
apartment: unitsData.apartment,
unit: self.unitToDelete,
nonce: unitsData.nonce
}
} ).then( function( response ) {
self.deletingUnits = false;
if ( response.success ) {
self.unitsList = response.data.units;
}
} ).catch( function( e ) {
self.deletingUnits = false;
alert( e.message );
} );
},
insertUnits: function() {
var self = this;
self.insertingUnits = true;
wp.apiFetch( {
method: 'post',
url: unitsData.insert_units,
data: {
number: self.newUnitsNum,
title: self.newUnitsTitle,
apartment: unitsData.apartment,
nonce: unitsData.nonce
}
} ).then( function( response ) {
self.insertingUnits = false;
if ( response.success ) {
self.unitsList = response.data.units;
}
} ).catch( function( e ) {
self.insertingUnits = false;
alert( e.message );
} );
}
}
} );
})( jQuery, window.JetABAFUnitsData );| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| blocks-view/ | 2026-07-21 14:16 | 104.48 KB | 76129f60960:kunden | dxwrx-r--r | |
| bookings-list-meta.js | 2026-07-21 14:16 | 1.4 KB | 76129f60960:kunden | -xw-x----- | |
| bookings.js | 2026-07-21 14:16 | 44.58 KB | 76129f60960:kunden | -xw-x----- | |
| calendars.js | 2026-07-21 14:16 | 4.8 KB | 76129f60960:kunden | -xw-x----- | |
| common.js | 2026-07-21 14:16 | 218 B | 76129f60960:kunden | -xw-x----- | |
| macros-inserter.js | 2026-07-21 14:16 | 6.61 KB | 76129f60960:kunden | -xw-x----- | |
| meta-configuration.js | 2026-07-21 14:16 | 974 B | 76129f60960:kunden | -xw-x----- | |
| meta-custom-schedule.js | 2026-07-21 14:16 | 1.6 KB | 76129f60960:kunden | -xw-x----- | |
| meta-extras.js | 2026-07-21 14:16 | 2.09 KB | 76129f60960:kunden | -xw-x----- | |
| meta-price.js | 2026-07-21 14:16 | 4.05 KB | 76129f60960:kunden | -xw-x----- | |
| schedule-manager.js | 2026-07-21 14:16 | 5.24 KB | 76129f60960:kunden | -xw-x----- | |
| set-up.js | 2026-07-21 14:16 | 2.36 KB | 76129f60960:kunden | -xw-x----- | |
| settings.js | 2026-07-21 14:16 | 12.36 KB | 76129f60960:kunden | -xw-x----- | |
| units-manager.js | 2026-07-21 14:16 | 2.47 KB | 76129f60960:kunden | -xw-x----- | |
| vendors.js | 2026-07-21 14:16 | 301 B | 76129f60960:kunden | -xw-x----- | |
| wc-details-builder.js | 2026-07-21 14:16 | 1.76 KB | 76129f60960:kunden | -xw-x----- | |