File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/modules/calendar/install/js/calendar/categorymanager/dist/categorymanager.bundle.min.js
Back
this.BX=this.BX||{};(function(e,t,a,o){"use strict";class r{constructor(e){this.updateData(e);this.calendarContext=o.Util.getCalendarContext();this.rooms=[]}updateData(e){this.data=e||{};this.id=parseInt(e.ID,10);this.name=e.NAME}addRoom(e){this.rooms.push(e)}getId(){return this.id}setCheckboxStatus(e){this.checkboxStatus=e}}class s extends t.SectionManager{constructor(e,t){super(e,t);this.setCategories(e.categories);this.setConfig(t);this.sortCategories();this.permissions=t.perm;this.locationContext=t.locationContext||null}sortCategories(){this.categoryIndex={};this.categories=this.categories.sort(((e,t)=>{if(e.name.toLowerCase()>t.name.toLowerCase()){return 1}if(e.name.toLowerCase()<t.name.toLowerCase()){return-1}return 0}));this.categories.forEach(((e,t)=>{this.categoryIndex[e.getId()]=t}))}setCategories(e=[]){this.categories=[];this.categoryIndex={};e.forEach((e=>{let t=new r(e);this.categories.push(t);this.categoryIndex[t.getId()]=this.categories.length-1}))}getCategories(){return this.categories}getCategory(e){return this.categories[this.categoryIndex[e]]}createCategory(e){return new Promise((t=>{e.name=this.checkName(e.name);BX.ajax.runAction("calendar.api.locationajax.createCategory",{data:{name:e.name,rooms:e.rooms}}).then((e=>{const r=e.data||[];this.setCategories(r);this.sortCategories();o.Util.getBX().Event.EventEmitter.emit("BX.Calendar.Rooms.Categories:create",new a.Event.BaseEvent({data:{categoryList:r}}));this.updateLocationContext(r);t(e.data)}),(e=>{BX.Calendar.Util.displayError(e.errors);t(e.data)}))}))}updateCategory(e){return new Promise((t=>{e.name=this.checkName(e.name);BX.ajax.runAction("calendar.api.locationajax.updateCategory",{data:{id:e.id,name:e.name,rooms:{toAddCategory:e.toAddCategory,toRemoveCategory:e.toRemoveCategory}}}).then((e=>{const a=e.data||[];this.setCategories(a);this.sortCategories();o.Util.getBX().Event.EventEmitter.emit("BX.Calendar.Rooms.Categories:create");this.updateLocationContext(a);t(e.data)}),(e=>{BX.Calendar.Util.displayError(e.errors);t(e.data)}))}))}deleteCategory(e){return new Promise((t=>{BX.ajax.runAction("calendar.api.locationajax.deleteCategory",{data:{id:e}}).then((e=>{const r=e.data||[];if(!r.length){BX.reload()}this.setCategories(r);this.sortCategories();o.Util.getBX().Event.EventEmitter.emit("BX.Calendar.Rooms.Categories:delete",new a.Event.BaseEvent({data:{categoryList:r}}));this.updateLocationContext(r);t(e.data)}),(e=>{BX.Calendar.Util.displayError(e.errors);t(e.data)}))}))}checkName(e){if(typeof e==="string"){e=e.trim();if(s.isEmpty(e)){e=a.Loc.getMessage("EC_SEC_SLIDER_NEW_CATEGORY")}}else{e=a.Loc.getMessage("EC_SEC_SLIDER_NEW_CATEGORY")}return e}static isEmpty(e){if(a.Type.isArray(e)){return!e.length}return e===null||e===undefined||e===""||e===[]||e==={}}canDo(e){return this.permissions[e]}unsetRooms(){this.categories.map((e=>e.rooms=[]))}handlePullCategoryChanges(e){if(e.command==="delete_category"){const t=parseInt(e.ID,10);if(this.categoryIndex[t]){this.reloadCategoriesFromDatabase().then(this.reloadDataDebounce());o.Util.getBX().Event.EventEmitter.emit("BX.Calendar.Rooms:pull-delete",new a.Event.BaseEvent({data:{categoryId:t}}))}else{this.reloadCategoriesFromDatabase().then(this.reloadDataDebounce());o.Util.getBX().Event.EventEmitter.emit("BX.Calendar.Rooms.Categories:pull-delete");o.Util.getBX().Event.EventEmitter.emit("BX.Calendar:doRefresh")}}else if(e.command==="create_category"){this.reloadCategoriesFromDatabase().then(this.reloadDataDebounce());o.Util.getBX().Event.EventEmitter.emit("BX.Calendar.Rooms.Categories:pull-create");o.Util.getBX().Event.EventEmitter.emit("BX.Calendar:doRefresh")}else if(e.command==="update_category"){this.reloadCategoriesFromDatabase().then(this.reloadDataDebounce());o.Util.getBX().Event.EventEmitter.emit("BX.Calendar.Rooms.Categories:pull-update");o.Util.getBX().Event.EventEmitter.emit("BX.Calendar:doRefresh")}else{this.reloadCategoriesFromDatabase().then(this.reloadDataDebounce())}}reloadCategoriesFromDatabase(){return new Promise((e=>{BX.ajax.runAction("calendar.api.locationajax.getCategoryList").then((t=>{this.setCategories(t.data.categories||[]);this.sortCategories();BX.Calendar.Controls.Location.setLocationList(t.data.rooms);e(t.data)}),(t=>{e(t.data)}))}))}unsetCategoryRooms(e){this.getCategory(e).rooms=[]}getCategoriesWithRooms(e){this.unsetRooms();const t={default:[],categories:this.getCategories()};let a;e.forEach((e=>{a=this.categoryIndex[e.categoryId];if(t["categories"][a]){t["categories"][a].addRoom(e)}else{t["default"].push(e)}}),this);return t}updateLocationContext(){if(this.locationContext!==null&&this.locationContext.roomsManagerFromDB!==null){this.locationContext.roomsManagerFromDB.reloadRoomsFromDatabase().then(this.locationContext.setValues.bind(this.locationContext))}}getCategoryRooms(e,t){const a=[];t.forEach((t=>{if(e.id===t.categoryId){a.push(t)}}));return a}}e.CategoryManager=s})(this.BX.Calendar=this.BX.Calendar||{},BX.Calendar,BX,BX.Calendar); //# sourceMappingURL=categorymanager.bundle.map.js
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.25 |
proxy
|
phpinfo
|
Settings