How to use schedule method in fast-check-monorepo

Best JavaScript code snippet using fast-check-monorepo

schedule_print.js

Source:schedule_print.js Github

copy

Full Screen

1Ext.namespace('schedule_space');2schedule_space.schedule = function() {3 Ext.QuickTips.init();4 function querySchedule(_vType, _sch_gubun, _sDate, _eDate) {5 scheduleDataStore = new Ext.data.Store({6 proxy: new Ext.data.HttpProxy(7 new Ext.data.Connection({8 url: 'schedule.auth.do?method=aj_schedule_list',9 extraParams: { view_type : _vType,10 sch_gubun : _sch_gubun,11 start_date : _sDate,12 end_date : _eDate13 },14 method: 'POST'15 })16 ),17 reader: new Ext.data.XmlReader({18 record: 'Record',19 id: 'SCHEDULE_IDX',20 totalRecords: 'recCount'21 },22 ['SCHEDULE_IDX','USERS_IDX','USERS_NAME','DOMAIN','USER_GROUP_IDX','SCHEDULE_SHARE','SCHEDULE_TYPE',23 'SCHEDULE_TITLE','SCHEDULE_STMT','SCHEDULE_SDATE','SCHEDULE_EDATE','SCHEDULE_REPEAT','SCHEDULE_DAYLY','SCHEDULE_ALAM',24 'SCHEDULE_ALAM_DATE','SCHEDULE_ALAM_WAY','SCHEDULE_DDAY','SHARE_GROUP_IDX','REPEAT_WEEK','REPEAT_MONTH','REPEAT_YEAR']25 ),26 remoteSort: false,27 sortInfo:{field:'SCHEDULE_SDATE', direction:'ASC'},28 autoLoad: true,29 listeners:{30 load:function() {31 _calendar.draw();32// document.getElementById("span_dislay_month").innerHTML = _calendar.date.format('m') + "월";33 self.print();34 }35 }36 });37 };38 function entryDraw(start, end) {39 var _entries = new Array();40 if (typeof scheduleDataStore != 'undefined' && scheduleDataStore.data.length> 0) {41 for(var ii=0; ii<scheduleDataStore.data.length; ii++ ) {42 id = scheduleDataStore.data.items[ii].data.SCHEDULE_IDX;43 category = schedule_type[scheduleDataStore.data.items[ii].data.SCHEDULE_TYPE];44 start = Calendar.str2date(scheduleDataStore.data.items[ii].data.SCHEDULE_SDATE);45 end = Calendar.str2date(scheduleDataStore.data.items[ii].data.SCHEDULE_EDATE);46 type = schdeule_idx_type[scheduleDataStore.data.items[ii].data.SCHEDULE_DAYLY];47 subject = scheduleDataStore.data.items[ii].data.SCHEDULE_TITLE;48 description = scheduleDataStore.data.items[ii].data.SCHEDULE_STMT;49 color = schedule_share_color[scheduleDataStore.data.items[ii].data.SCHEDULE_SHARE];50 bg = schedule_share_bgcolor[scheduleDataStore.data.items[ii].data.SCHEDULE_SHARE];51 icon = "";52 allowTag = true;53 userDate = "";54 _entries.push( new Calendar.Entry(id, category, start, end, type, "["+category+"]"+subject, description, color, bg, "", allowTag));55 }56 }57 _calendar.removeEntryAll();58 for(entry in _entries) {59 _calendar.addEntry(_entries[entry]);60 }61 };62 function entryMove(entry, start, end) {63 return true;64 };65 function entryClick(entry, x, y) {66 schedule_space.schedule_detail.openScheduleDetailWindow(entry.id, true);67 };68 function calendarClick(start, end) {69 //true를 리턴하면 엔트리가 이동이 됨, false를 리턴하면 엔트리 이동이 취소됨70 if (start == null) {71 start = new Date();72 end = new Date();73 }74 schedule_space.schedule_regist.openScheduleRegistWindow(start, end);75 };76 function entryQuickAdd(start, end) {77 //alert('ㅇㅇㅇㅇ일정추가');78 };79 function setEntries() {80 var id, category, start, end, type, subject, description, color, bg, icon, allowTag, userDate;81 _entries = new Array();82 for(var ii=0; ii<scheduleDataStore.data.length; ii++ ) {83 id = scheduleDataStore.data.items[ii].data.SCHEDULE_IDX;84 category = schedule_type[scheduleDataStore.data.items[ii].data.SCHEDULE_TYPE];85 start = scheduleDataStore.data.items[ii].data.SCHEDULE_SDATE;86 end = scheduleDataStore.data.items[ii].data.SCHEDULE_EDATE;87 type = schedule_type[scheduleDataStore.data.items[ii].data.SCHEDULE_TYPE];88 subject = scheduleDataStore.data.items[ii].data.SCHEDULE_TITLE;89 description = scheduleDataStore.data.items[ii].data.SCHEDULE_STMT;90 color = schedule_share_color[scheduleDataStore.data.items[ii].data.SCHEDULE_SHARE];91 bg = schedule_share_bgcolor[scheduleDataStore.data.items[ii].data.SCHEDULE_SHARE];92 icon = "";93 allowTag = true;94 userDate = "";95 _entries.push( new Calendar.Entry(id, category, start, end, type, subject, description, color, bg, "", allowTag));96 }97 };98 //일정보기(일,4일,주,2주,월)99 function viewScheduleList(_vType,divId_num) {100 var objForm = document.f_schedule_view;101 var _sDate;102 var _eDate;103 var view_arr = new Array();104 view_arr = ["월간","2주간","주간","4일간","일간"]105 for(i=0; i<5; i++){106 if( i == divId_num){107 document.getElementById("view_type_"+i).innerHTML = "<b>"+view_arr[i]+"</b>";108 }else{109 document.getElementById("view_type_"+i).innerHTML = view_arr[i];110 }111 }112 //calDate = _calendar.date.format('Y/m/d');113 //new Date(_date.replace(/\-/g,"/"));114 _sDate = getStartDate(_vType, _calendar.date);115 _eDate = getEndDate(_vType, _calendar.date);116 //검색범위가 현재범위 벗어난경우 스케줄 조회117 if (_sDate < _calendar.start || _eDate > _calendar.end ) {118 if (_vType != "month") {119 _sDate = _sDate.add(Date.DAY, -7);120 _eDate = _eDate.add(Date.DAY, 7);121 }122 //스케줄 조회123 querySchedule(_calendar.view, objForm.sch_gubun.value, _sDate.format('Y-m-d'), _eDate.format('Y-m-d'));124 }125 _calendar.changeView(_vType);126 //document.getElementById("span_dislay_month").innerHTML = _calendar.date.format('m') + "월";127 };128 //일정이동129 function moveScheduleList(_action) {130 var objForm = document.f_schedule_view;131 var _vType = _calendar.view;132 var _sDate, _eDate, _date;133 _date = _calendar.date;134 if (_action == 'prev') {135 if (_vType == "day" || _vType == "4day") {136 _date = _date.add(Date.DAY, -1);137 _sDate = getStartDate(_vType, _date);138 _eDate = getEndDate(_vType, _date);139 }else if (_vType == "week" || _vType == "2week") {140 _date = _date.add(Date.DAY, -7);141 _sDate = getStartDate(_vType, _date);142 _eDate = getEndDate(_vType, _date);143 }else if (_vType == "month") {144 _date = _date.add(Date.MONTH, -1);145 _sDate = getStartDate(_vType, _date);146 _eDate = getEndDate(_vType, _date);147 }148 if (_sDate < _calendar.start || _eDate > _calendar.end ) {149 //스케줄 조회150 if (_vType != "month") {151 _sDate = _sDate.add(Date.DAY, -7);152 _eDate = _eDate.add(Date.DAY, 7);153 }154 querySchedule(_calendar.view, objForm.sch_gubun.value, _sDate.format('Y-m-d'), _eDate.format('Y-m-d'));155 }156 _calendar.movePrev();157 } else if (_action == 'today') {158 _date = new Date();159 _sDate = getStartDate(_vType, _date);160 _eDate = getEndDate(_vType, _date);161 if (_sDate < _calendar.start || _eDate > _calendar.end ) {162 //스케줄 조회163 if (_vType != "month") {164 _sDate = _sDate.add(Date.DAY, -7);165 _eDate = _eDate.add(Date.DAY, 7);166 }167 querySchedule(_calendar.view, objForm.sch_gubun.value, _sDate.format('Y-m-d'), _eDate.format('Y-m-d'));168 }169 _calendar.moveToday();170 } else if (_action == 'next') {171 if (_vType == "day" || _vType == "4day") {172 _date = _date.add(Date.DAY, 1);173 _sDate = getStartDate(_vType, _date);174 _eDate = getEndDate(_vType, _date);175 }else if (_vType == "week" || _vType == "2week") {176 _date = _date.add(Date.DAY, 7);177 _sDate = getStartDate(_vType, _date);178 _eDate = getEndDate(_vType, _date);179 }else if (_vType == "month") {180 _date = _date.add(Date.MONTH, 1);181 _sDate = getStartDate(_vType, _date);182 _eDate = getEndDate(_vType, _date);183 }184 if (_sDate < _calendar.start || _eDate > _calendar.end ) {185 //스케줄 조회186 if (_vType != "month") {187 _sDate = _sDate.add(Date.DAY, -7);188 _eDate = _eDate.add(Date.DAY, 7);189 }190 querySchedule(_calendar.view, objForm.sch_gubun.value, _sDate.format('Y-m-d'), _eDate.format('Y-m-d'));191 }192 _calendar.moveNext();193 }194 document.getElementById("span_dislay_month").innerHTML = _calendar.date.format('m') + "월";195 };196 function getStartDate(_type, _date) {197 if (_type == "day" || _type == "4day") {198 return _date;199 }else if (_type == "week") {200 return _date.add(Date.DAY, -_date.format('N'));201 }else if (_type == "2week") {202 return _date.add(Date.DAY, -_date.format('N'));203 }else if (_type == "month") {204 _date = _date.getFirstDateOfMonth();205 return _date.add(Date.DAY, -_date.format('N'));206 }207 };208 function getEndDate(_type, _date) {209 if (_type == "day") {210 return _date;211 }else if (_type == "4day") {212 return _date.add(Date.DAY, 3);213 }else if (_type == "week") {214 _date = _date.add(Date.DAY, -_date.format('N'));215 return _date.add(Date.DAY, 6);216 }else if (_type == "2week") {217 _date = _date.add(Date.DAY, -_date.format('N'));218 return _date.add(Date.DAY, 13);219 }else if (_type == "month") {220 _date = _date.getLastDateOfMonth();221 return _date.add(Date.DAY, (6 - _date.format('N')));222 }223 };224 function moveSchedule(_date) {225 var objForm = document.f_schedule_view;226 var _sDate, _eDate;227 if (_date < _calendar.start || _date > _calendar.end ) {228 //_sDate = _date.add(Date.DAY, -7);229 //_eDate = _date.add(Date.DAY, 7);230 _sDate = _date;231 _eDate = _date;232 //스케줄 조회233 querySchedule(_calendar.view, objForm.sch_gubun.value, _sDate.format('Y-m-d'), _eDate.format('Y-m-d'));234 }235 _calendar.changeView("day");236 document.getElementById("span_dislay_month").innerHTML = _calendar.date.format('m') + "월";237 _calendar.go(_date.format('Y'), _date.format('m'), _date.format('d'));238 };239 function moveDailySchedule(_date) {240 moveSchedule(new Date(_date.substring(0,4), _date.substring(5,7)-1, _date.substring(8)));241 };242 function schedulePrint() {243 var schedule_print = window.open("schedule.auth.do?method=schedule_print" ,"schedule_print","status=no,toolbar=no,scroll=yes,resizable=yes,width=820,height=600");244 };245 function create_scheudle() {246 var objForm = document.f_schedule_view;247 Calendar.Language='ko';248 _calendar = new Calendar('div_schedule', 'month', (new Date()).format('Y-m-d'), false);249 _calendar.attachEvent('drawFinish', entryDraw); //캘린더가 그려지면 호출할 함수, 주로 엔트리 추가시 사용된다250 _calendar.attachEvent('entryMove', entryMove); // 엔트리를 이동할 때 호출할 함수251 _calendar.attachEvent('entryClick', entryClick); // 엔트리를 이동할 때 호출할 함수252 _calendar.attachEvent('timeSelect', calendarClick); //253 _calendar.attachEvent('entryMenu', calendarClick);254 _calendar.draw();255 querySchedule(_calendar.view, objForm.sch_gubun.value, _calendar.start.format('Y-m-d'), _calendar.end.format('Y-m-d'));256 };257 function goScheduleView(sch_gubun) {258 querySchedule(_calendar.view, sch_gubun, _calendar.start.format('Y-m-d'), _calendar.end.format('Y-m-d'));259 };260 function scheduleBodyResize() {261 var div= document.getElementById('div_schedule');262 if (!div) return;263 //div.style.width= Ext.get(document.getElementById("div_schedule")).getWidth()-32+"px";264 //div.style.height= Ext.get(document.getElementById("div_schedule")).getHeight()-105+"px";265 if(_calendar !=null) _calendar.draw();266 };267 function reloadSchedule() {268 var objForm = document.f_schedule_view;269 schedule_space.schedule.querySchedule(_calendar.view, objForm.sch_gubun.value, _calendar.start.format('Y-m-d'), _calendar.end.format('Y-m-d'));270 left_schedule_space.left_schedule.leftScheduleReload();271 };272 return {273 moveSchedule: function(_date) {return moveSchedule(_date);},274 moveDailySchedule: function(_date) {return moveDailySchedule(_date);},275 moveScheduleList: function(_action) {return moveScheduleList(_action);},276 goScheduleView: function(sch_gubun) {return goScheduleView(sch_gubun);},277 schedulePrint: function() {return schedulePrint();},278 calendarClick: function() {return calendarClick();},279 viewScheduleList: function(_vType,_vType_num) {return viewScheduleList(_vType,_vType_num);},280 querySchedule: function(_vType, _sch_gubun, _sDate, _eDate) {return querySchedule(_vType, _sch_gubun, _sDate, _eDate);},281 reloadSchedule: function() {return reloadSchedule();},282 init: function() {283 //Ext.EventManager.onWindowResize(function(){ scheduleBodyResize(),false});284 //setTimeout(function(){285 create_scheudle();286 //_calendar.heigh = "100%";287 //scheduleBodyResize();288 //}, 100);289 }290 }291}();292schedule_space.schedule_regist = function() {293 var win_schedule_regist;294 var win_usergroup_tree;295 function openScheduleRegistWindow(startdt, enddt, winType) {296 var startdt_date, startdt_time, enddt_date, enddt_time;297 startdt_date = startdt.format('Y-m-d');298 enddt_date = enddt.format('Y-m-d');299 startdt_time = startdt.format('H:i');300 enddt_time = enddt.format('H:i');301 document.getElementById('schedule_pop_div').style.display ='none';302 document.getElementById('schedule_pop_div').style.display ='';303 clearForm(document.f_sr);304 document.getElementById("schedule_pop_div_title").innerHTML = "일정등록";305 scheduleWriteInit(startdt_date,startdt_time,enddt_date,enddt_time);306 document.getElementById('schedule_pop_div_save_buttom').innerHTML = "<a href='javascript:schedule_space.schedule_regist.scheduleRegist();'><img src='/images/kor/btn/btnA_save.gif' /></a>";307//308 };309 function closeScheduleRegistWindow() {310 if (win_schedule_regist instanceof Ext.Window) {311 win_schedule_regist.close();312 }313 };314 function openUserGroupTree() {315 win_usergroup_tree = new Ext.Window({316 id:'kebi_ext_window_sd_tree',317 title:'일정관리',318 colsable:true,319 width:630,320 plain:true,321 autoScroll:true,322 autoSize:true,323 closeAction:'close',324 items:new Ext.Panel({325 autoScroll: true,326 scripts:true,327 autoLoad:{328 url:'schedule.auth.do?method=schedule_regist_form',329 scripts:true330 }331 })332 });333 win_usergroup_tree.show();334 };335 function setRepeatDiv(startdt_date, enddt_date, startdt_time, enddt_time){336 var df1 = new Ext.form.DateField({337 id:'startdt_date_no',338 name:'startdt_date_no',339 format: 'Y-m-d',340 vtype: 'daterange',341 itemCls:'s_picker',342 readOnly :true,343 endDateField: 'enddt_date_no'344 })345 df1.render('norepeat_stdate');346 var df2 = new Ext.form.DateField({347 id:'enddt_date_no',348 name:'enddt_date_no',349 format: 'Y-m-d',350 vtype: 'daterange',351 readOnly :true,352 startDateField: 'startdt_date_no'353 })354 df2.render('norepeat_eddate');355 var df3 = new Ext.form.DateField({356 id:'startdt_date_re',357 name:'startdt_date_re',358 format: 'Y-m-d',359 vtype: 'daterange',360 readOnly :true,361 endDateField: 'enddt_date_re'362 })363 df3.render('repeat_stdate');364 var df4 = new Ext.form.DateField({365 id:'enddt_date_re',366 name:'enddt_date_re',367 format: 'Y-m-d',368 vtype: 'daterange',369 readOnly :true,370 startDateField: 'startdt_date_re'371 })372 df4.render('repeat_eddate');373 df1.setValue(startdt_date);374 df2.setValue(enddt_date);375 df3.setValue(startdt_date);376 df4.setValue(enddt_date);377 var tf1 =new Ext.form.TimeField({378 id:'startdt_time_no',379 name:'startdt_time_no',380 format: 'H:i',381 value: startdt_time,382 readOnly :true,383 endTimeField:'enddt_time_no',384 width:60385 })386 tf1.render('norepeat_sttime');387 var tf2 =new Ext.form.TimeField({388 id:'enddt_time_no',389 name:'enddt_time_no',390 format: 'H:i',391 value: enddt_time,392 readOnly :true,393 startTimeField:'startdt_time_no',394 width:60395 })396 tf2.render('norepeat_edtime');397 var tf3 =new Ext.form.TimeField({398 id:'startdt_time_re',399 name:'startdt_time_re',400 format: 'H:i',401 readOnly :true,402 value: startdt_time,403 width:50404 })405 tf3.render('repeat_sttime');406 var tf4 =new Ext.form.TimeField({407 id:'enddt_time_re',408 name:'enddt_time_re',409 format: 'H:i',410 readOnly :true,411 value: enddt_time,412 width:50413 })414 tf4.render('repeat_edtime');415 };416 function reSetRepeatDiv(){417 try{418 Ext.getCmp('startdt_date_no').destroy();419 Ext.getCmp('enddt_date_no').destroy();420 Ext.getCmp('startdt_date_re').destroy();421 Ext.getCmp('enddt_date_re').destroy();422 Ext.getCmp('startdt_time_no').destroy();423 Ext.getCmp('enddt_time_no').destroy();424 Ext.getCmp('startdt_time_re').destroy();425 Ext.getCmp('enddt_time_re').destroy();426 }catch(e){}427 };428 function onClickShareOpt(_type) {429 if(_type == 1) {430 document.getElementById("dv_share_group").style.display = 'block';431 } else {432 document.getElementById("dv_share_group").style.display = 'none';433 }434 };435 function CheckScheduleRepeat(_type) {436 if(_type == 0) {437 document.getElementById("div_sch_norepeat").style.display = 'block';438 document.getElementById("div_sch_repeat").style.display = 'none';439 } else {440 document.getElementById("div_sch_norepeat").style.display = 'none';441 document.getElementById("div_sch_repeat").style.display = 'block';442 }443 };444 //일정등록445 function scheduleRegist() {446 var objForm = document.f_schedule_view;447 if(document.getElementById("SCHEDULE_TITLE").value=="") {448 alert("일정제목을 입력하세요.");449 document.getElementById("SCHEDULE_TITLE").focus();450 return;451 } else if (document.getElementById("SCHEDULE_STMT").value == "") {452 alert("일정내용을 입력하세요.");453 document.getElementById("SCHEDULE_STMT").focus();454 return;455 }456 if (document.getElementsByName("SCHEDULE_REPEAT")[0].checked) {457 if(document.getElementById("startdt_date_no") > document.getElementById("enddt_date_no")) {458 alert("일정시작일은 종료일보다 작아야 합니다.");459 return;460 }461 if(document.getElementById("startdt_date_no") == document.getElementById("enddt_date_no")) {462 if(document.getElementById("startdt_time_no") == document.getElementById("enddt_time_no")) {463 alert("일정시작시간은 종료시간보다 작아야 합니다.");464 return;465 }466 }467 } else if (!document.getElementsByName("SCHEDULE_REPEAT")[0].checked) {468 if(document.getElementById("startdt_date_re") > document.getElementById("enddt_date_re")) {469 alert("일정시작일은 종료일보다 작아야 합니다.");470 return;471 }472 if(document.getElementById("startdt_date_re") == document.getElementById("enddt_date_re")) {473 if(document.getElementById("startdt_time_re") == document.getElementById("enddt_time_re")) {474 alert("일정시작시간은 종료시간보다 작아야 합니다.");475 return;476 }477 }478 };479 //if (confirm("일정을 등록 하시겠습니까?")) {480 Ext.Ajax.request({481 url:'schedule.auth.do?method=aj_schedule_regist',482 method:'POST',483 form: 'f_sr',484 success:function(response, opt){485 var reader = new Ext.data.XmlReader({486 record: 'RESPONSE'487 },488 ['RESULT','MESSAGE']);489 var resultXML = reader.read(response);490 if (resultXML.records[0].data.RESULT == "success") {491 closeDiv('schedule_pop_div');492 //closeScheduleRegistWindow();493 schedule_space.schedule.querySchedule(_calendar.view, objForm.sch_gubun.value, _calendar.start.format('Y-m-d'), _calendar.end.format('Y-m-d'));494 left_schedule_space.left_schedule.leftScheduleReload();495 } else {496 alert(resultXML.records[0].data.MESSAGE);497 }498 },499 failure:function(){500 alert('등록 오류','일정등록중 오류가 발생하였습니다.\n관리자에게 문의 하시기 바랍니다.')501 }502 });503 //}504 };505 function addMemorialDay() {506 schedule_space.schedule_regist.openScheduleRegistWindow(new Date(), new Date(), "M");507 };508 function addDDay() {509 schedule_space.schedule_regist.openScheduleRegistWindow(new Date(), new Date(), "D");510 };511 return {512 openScheduleRegistWindow: function(startdt, enddt, winType) {return openScheduleRegistWindow(startdt, enddt, winType);},513 setRepeatDiv: function(startdt_date, enddt_date, startdt_time, enddt_time) {return setRepeatDiv(startdt_date, enddt_date, startdt_time, enddt_time);},514 scheduleRegist: function() {return scheduleRegist();},515 closeScheduleRegistWindow: function() {return closeScheduleRegistWindow();},516 CheckScheduleAlam: function() {return CheckScheduleAlam();},517 CheckScheduleRepeat: function(_type) {return CheckScheduleRepeat(_type);},518 onClickShareOpt: function() {return onClickShareOpt();},519 addMemorialDay: function() {return addMemorialDay();},520 addDDay: function() {return addDDay();},521 reSetRepeatDiv:function() { return reSetRepeatDiv();}522 }523}();524schedule_space.schedule_detail = function() {525 var win_schedule_detail;526 function openScheduleDetailWindow(_schedule_idx, dummy_key) {527 Ext.Ajax.request({528 scope :this,529 url: 'schedule.auth.do?method=aj_schedule_info_by_xml',530 method : 'POST',531 params: {532 method:'schedule_info',533 SCHEDULE_IDX:_schedule_idx,534 dummy_key:dummy_key535 },536 success : function(response, options) {537 try {538 var reader = new Ext.data.XmlReader({record: 'RESPONSE'},['RESULT','MESSAGE',539 'SCHEDULE_IDX',540 'P_SCHEDULE_IDX',541 'USERS_IDX',542 'USERS_NAME',543 'DOMAIN',544 'USER_GROUP_IDX',545 'SCHEDULE_SHARE',546 'SHARE_GROUP_IDX',547 'SCHEDULE_TYPE',548 'SCHEDULE_TITLE',549 'SCHEDULE_STMT',550 'SCHEDULE_SDATE',551 'SCHEDULE_EDATE',552 'SCHEDULE_REPEAT',553 'SCHEDULE_DAYLY',554 'SCHEDULE_ALAM',555 'SCHEDULE_ALAM_DATE',556 'SCHEDULE_ALAM_WAY',557 'SCHEDULE_DDAY',558 'REPEAT_WEEK',559 'REPEAT_MONTH',560 'REPEAT_YEAR']);561 var resultXML = reader.read(response);562 if (resultXML.records[0].data.RESULT == "success") {563 document.getElementById("schedule_pop_div_title").innerHTML = "일정보기 / 수정";564 var startdt_date, startdt_time, enddt_date, enddt_time;565 startdt_date = resultXML.records[0].data.SCHEDULE_SDATE.substring(0, 10);566 enddt_date = resultXML.records[0].data.SCHEDULE_EDATE.substring(0, 10);567 startdt_time = resultXML.records[0].data.SCHEDULE_SDATE.substring(11, 16);568 enddt_time = resultXML.records[0].data.SCHEDULE_EDATE.substring(11, 16);569 document.getElementById('schedule_pop_div').style.display ='none';570 document.getElementById('schedule_pop_div').style.display ='';571 clearForm(document.f_sr);572 scheduleWriteInit(startdt_date,startdt_time,enddt_date,enddt_time);573 var objForm = document.f_sr;574 objForm.SCHEDULE_IDX.value= resultXML.records[0].data.SCHEDULE_IDX;575 objForm.SCHEDULE_TITLE.value = resultXML.records[0].data.SCHEDULE_TITLE;576 objForm.SCHEDULE_STMT.value = resultXML.records[0].data.SCHEDULE_STMT;577 setCheckedRadioByValue( document.f_sr.SCHEDULE_SHARE, resultXML.records[0].data.SCHEDULE_SHARE ); //일정구분578 setSelectedIndexByValue( document.f_sr.SCHEDULE_TYPE, resultXML.records[0].data.SCHEDULE_TYPE ); //일정종류579 setCheckedRadioByValue( document.f_sr.SCHEDULE_REPEAT, resultXML.records[0].data.SCHEDULE_REPEAT ); //일정반복580 setCheckBoxByValue( document.f_sr.SCHEDULE_DAYLY_NO, resultXML.records[0].data.SCHEDULE_DAYLY_NO ); //종일일정581 setCheckBoxByValue( document.f_sr.SCHEDULE_DAYLY_RE, resultXML.records[0].data.SCHEDULE_DAYLY_RE ); //종일일정582 setSelectedIndexByValue( document.f_sr.SCHEDULE_ALAM, resultXML.records[0].data.SCHEDULE_ALAM ); //일정알림583 setSelectedIndexByValue( document.f_sr.SHARE_GROUP_IDX, resultXML.records[0].data.SHARE_GROUP_IDX ); //그룹584 setCheckBoxByValue( document.f_sr.SCHEDULE_DDAY, resultXML.records[0].data.SCHEDULE_DDAY ); //D-DAY585 if( resultXML.records[0].data.USERS_IDX == objForm.USERS_IDX.value || isAdmin=="true"){586 document.getElementById('schedule_pop_div_save_buttom').innerHTML = "<a href='javascript:schedule_space.schedule_update.scheduleUpdate();'><img src='/images/kor/btn/btnA_save.gif' /></a>&nbsp;&nbsp;<a href='javascript:schedule_space.schedule_detail.ScheduleDelete("+resultXML.records[0].data.SCHEDULE_IDX+");'><img src='/images/kor/btn/btnA_delete2.gif' /></a>";587 }else{588 document.getElementById('schedule_pop_div_save_buttom').innerHTML = "";589 }590 if (resultXML.records[0].data.SCHEDULE_ALAM_WAY == "1") {591 document.f_sr.SCHEDULE_ALARM_WAY_MAIL.checked = true;592 } else if (resultXML.records[0].data.SCHEDULE_ALAM_WAY == "2") {593 document.f_sr.SCHEDULE_ALARM_WAY_MAIL.checked = false;594 } else if (resultXML.records[0].data.SCHEDULE_ALAM_WAY == "3") {595 document.f_sr.SCHEDULE_ALARM_WAY_MAIL.checked = true;596 }597 }598 } catch(e) {599 return ;600 }601 },602 failure : function(response, options) {603 }604 });605 }606 function closeScheduleDetailWindow() {607 if (win_schedule_detail instanceof Ext.Window) {608 win_schedule_detail.close();609 }610 };611 function ScheduleDelete(_schedule_idx) {612 var objForm = document.f_schedule_view;613 if (!confirm("일정을 삭제 하시겠습니까.")) {614 return;615 }616 Ext.Ajax.request({617 url:'schedule.auth.do?method=aj_schedule_delete&SCHEDULE_IDX=' + _schedule_idx,618 method:'POST',619 success:function(response, opt){620 var reader = new Ext.data.XmlReader({621 record: 'RESPONSE'622 },623 ['RESULT','MESSAGE']);624 var resultXML = reader.read(response);625 if (resultXML.records[0].data.RESULT == "success") {626 closeDiv('schedule_pop_div');627 schedule_space.schedule.querySchedule(_calendar.view, objForm.sch_gubun.value, _calendar.start.format('Y-m-d'), _calendar.end.format('Y-m-d'));628 left_schedule_space.left_schedule.leftScheduleReload();629 } else {630 alert(resultXML.records[0].data.MESSAGE);631 }632 },633 failure:function(){634 alert('삭제 오류','일정 삭제중 오류가 발생하였습니다.\n관리자에게 문의 하시기 바랍니다.')635 }636 })637 };638 return {639 openScheduleDetailWindow:function(_schedule_idx, dummy_key) {return openScheduleDetailWindow(_schedule_idx, dummy_key);},640 closeScheduleDetailWindow:function() {return closeScheduleDetailWindow();},641 ScheduleDelete:function(_schedule_idx) {return ScheduleDelete(_schedule_idx);}642 }643}();644schedule_space.schedule_update = function() {645 var win_schedule_update;646 function openScheduleUpdateWindow(_schedule_idx) {647 schedule_space.schedule_detail.closeScheduleDetailWindow();648 win_schedule_update = new Ext.Window({649 id:'kebi_ext_window_sd_update',650 title:'상세일정수정',651 colsable:true,652 width:630,653 plain:true,654 pageX:185,655 pageY:100,656 autoScroll:true,657 autoSize:true,658 closeAction:'close',659 items:new Ext.Panel({660 autoScroll: true,661 autoLoad:{662 url:'schedule.auth.do?method=schedule_update_form',663 params:{SCHEDULE_IDX:_schedule_idx},664 scripts:true665 }666 })667 });668 win_schedule_update.show();669 };670 function closeScheduleUpdateWindow() {671 if (win_schedule_update instanceof Ext.Window) {672 win_schedule_update.close();673 }674 };675 function scheduleUpdate() {676 var objForm = document.f_schedule_view;677 if(document.getElementById("SCHEDULE_TITLE").value=="") {678 alert("일정제목을 입력하세요.");679 document.getElementById("SCHEDULE_TITLE").focus();680 return;681 } else if (document.getElementById("SCHEDULE_STMT").value == "") {682 alert("일정내용을 입력하세요.");683 document.getElementById("SCHEDULE_STMT").focus();684 return;685 }686 if (document.getElementsByName("SCHEDULE_REPEAT")[0].checked) {687 if(document.getElementById("startdt_date_no") > document.getElementById("enddt_date_no")) {688 alert("일정시작일은 종료일보다 작아야 합니다.");689 return;690 }691 if(document.getElementById("startdt_date_no") == document.getElementById("enddt_date_no")) {692 if(document.getElementById("startdt_time_no") == document.getElementById("enddt_time_no")) {693 alert("일정시작시간은 종료시간보다 작아야 합니다.");694 return;695 }696 }697 } else if (!document.getElementsByName("SCHEDULE_REPEAT")[0].checked) {698 if(document.getElementById("startdt_date_re") > document.getElementById("enddt_date_re")) {699 alert("일정시작일은 종료일보다 작아야 합니다.");700 return;701 }702 if(document.getElementById("startdt_date_re") == document.getElementById("enddt_date_re")) {703 if(document.getElementById("startdt_time_re") == document.getElementById("enddt_time_re")) {704 alert("일정시작시간은 종료시간보다 작아야 합니다.");705 return;706 }707 }708 }709 Ext.Ajax.request({710 url:'schedule.auth.do?method=aj_schedule_update',711 method:'POST',712 form: 'f_sr',713 success:function(response, opt){714 var reader = new Ext.data.XmlReader({715 record: 'RESPONSE'716 },717 ['RESULT','MESSAGE']);718 var resultXML = reader.read(response);719 if (resultXML.records[0].data.RESULT == "success") {720 closeDiv('schedule_pop_div');721 schedule_space.schedule.querySchedule(_calendar.view, objForm.sch_gubun.value, _calendar.start.format('Y-m-d'), _calendar.end.format('Y-m-d'));722 left_schedule_space.left_schedule.leftScheduleReload();723 } else {724 alert(resultXML.records[0].data.MESSAGE);725 }726 },727 failure:function(){728 alert('삭제 오류','일정 수정중 오류가 발생하였습니다.\n관리자에게 문의 하시기 바랍니다.')729 }730 });731 };732 return {733 openScheduleUpdateWindow:function(_schedule_idx) {return openScheduleUpdateWindow(_schedule_idx);},734 closeScheduleUpdateWindow:function() {return closeScheduleUpdateWindow();},735 scheduleUpdate:function() {return scheduleUpdate();}736 }737}();738Ext.onReady(schedule_space.schedule.init, schedule_space.schedule, true);739function closeDiv(obj){740 try{741 document.getElementById(obj).style.display ='none';742 }catch(e){}743}744function clearForm(obj){745 obj.reset();746}747function moveSchedule(_date) {748 var objForm = document.f_schedule_view;749 var _sDate, _eDate;750 if (_date < _calendar.start || _date > _calendar.end ) {751 //_sDate = _date.add(Date.DAY, -7);752 //_eDate = _date.add(Date.DAY, 7);753 _sDate = _date;754 _eDate = _date;755 //스케줄 조회756 querySchedule(_calendar.view, objForm.sch_gubun.value, _sDate.format('Y-m-d'), _eDate.format('Y-m-d'));757 }758 _calendar.changeView("day");759 document.getElementById("span_dislay_month").innerHTML = _calendar.date.format('m') + "월";760 _calendar.go(_date.format('Y'), _date.format('m'), _date.format('d'));...

Full Screen

Full Screen

app-calendar.js

Source:app-calendar.js Github

copy

Full Screen

1/*=========================================================================================2 File Name: toast-ui-calendar.js3 Description: toast-ui-calendar4 --------------------------------------------------------------------------------------5 Item Name: Frest HTML Admin Template6 Version: 1.07 Author: PIXINVENT8 Author URL: http://www.themeforest.net/user/pixinvent9==========================================================================================*/10'use strict';11(function (window, Calendar) {12 // variables13 var cal, resizeThrottled;14 var useCreationPopup = true;15 var useDetailPopup = true;16 // default keys and styles of calendar17 var themeConfig = {18 'common.border': '1px solid #DFE3E7',19 'common.backgroundColor': 'white',20 'common.holiday.color': '#FF5B5C',21 'common.saturday.color': '#304156',22 'common.dayname.color': '#304156',23 'month.dayname.borderLeft': '1px solid transparent',24 'month.dayname.fontSize': '1rem',25 'week.dayGridSchedule.borderRadius': '4px',26 'week.timegridSchedule.borderRadius': '4px',27 }28 // calendar initialize here29 cal = new Calendar('#calendar', {30 defaultView: 'month',31 useCreationPopup: useCreationPopup,32 useDetailPopup: useDetailPopup,33 calendars: CalendarList,34 theme: themeConfig,35 template: {36 milestone: function (model) {37 return '<span class="bx bx-flag align-middle"></span> <span style="background-color: ' + model.bgColor + '">' + model.title + '</span>';38 },39 allday: function (schedule) {40 return getTimeTemplate(schedule, true);41 },42 time: function (schedule) {43 return getTimeTemplate(schedule, false);44 }45 }46 });47 // calendar default on click event48 cal.on({49 'clickSchedule': function (e) {50 $(".tui-full-calendar-popup-top-line").css("background-color", e.calendar.color);51 $(".tui-full-calendar-calendar-dot").css("background-color", e.calendar.borderColor);52 },53 'beforeCreateSchedule': function (e) {54 // new schedule create and save55 saveNewSchedule(e);56 },57 'beforeUpdateSchedule': function (e) {58 // schedule update59 e.schedule.start = e.start;60 e.schedule.end = e.end;61 cal.updateSchedule(e.schedule.id, e.schedule.calendarId, e.schedule);62 },63 'beforeDeleteSchedule': function (e) {64 // schedule delete65 console.log('beforeDeleteSchedule', e);66 cal.deleteSchedule(e.schedule.id, e.schedule.calendarId);67 },68 'clickTimezonesCollapseBtn': function (timezonesCollapsed) {69 if (timezonesCollapsed) {70 cal.setTheme({71 'week.daygridLeft.width': '77px',72 'week.timegridLeft.width': '77px'73 });74 } else {75 cal.setTheme({76 'week.daygridLeft.width': '60px',77 'week.timegridLeft.width': '60px'78 });79 }80 return true;81 }82 });83 // Create Event according to their Template84 function getTimeTemplate(schedule, isAllDay) {85 var html = [];86 var start = moment(schedule.start.toUTCString());87 if (!isAllDay) {88 html.push('<span>' + start.format('HH:mm') + '</span> ');89 }90 if (schedule.isPrivate) {91 html.push('<span class="bx bxs-lock-alt font-size-small align-middle"></span>');92 html.push(' Private');93 } else {94 if (schedule.isReadOnly) {95 html.push('<span class="bx bx-block font-size-small align-middle"></span>');96 } else if (schedule.recurrenceRule) {97 html.push('<span class="bx bx-repeat font-size-small align-middle"></span>');98 } else if (schedule.attendees.length) {99 html.push('<span class="bx bxs-user font-size-small align-middle"></span>');100 } else if (schedule.location) {101 html.push('<span class="bx bxs-map font-size-small align-middle"></span>');102 }103 html.push(' ' + schedule.title);104 }105 return html.join('');106 }107 // A listener for click the menu108 function onClickMenu(e) {109 var target = $(e.target).closest('[role="menuitem"]')[0];110 var action = getDataAction(target);111 var options = cal.getOptions();112 var viewName = '';113 // on click of dropdown button change calendar view114 switch (action) {115 case 'toggle-daily':116 viewName = 'day';117 break;118 case 'toggle-weekly':119 viewName = 'week';120 break;121 case 'toggle-monthly':122 options.month.visibleWeeksCount = 0;123 options.month.isAlways6Week = false;124 viewName = 'month';125 break;126 case 'toggle-weeks2':127 options.month.visibleWeeksCount = 2;128 viewName = 'month';129 break;130 case 'toggle-weeks3':131 options.month.visibleWeeksCount = 3;132 viewName = 'month';133 break;134 case 'toggle-narrow-weekend':135 options.month.narrowWeekend = !options.month.narrowWeekend;136 options.week.narrowWeekend = !options.week.narrowWeekend;137 viewName = cal.getViewName();138 target.querySelector('input').checked = options.month.narrowWeekend;139 break;140 case 'toggle-start-day-1':141 options.month.startDayOfWeek = options.month.startDayOfWeek ? 0 : 1;142 options.week.startDayOfWeek = options.week.startDayOfWeek ? 0 : 1;143 viewName = cal.getViewName();144 target.querySelector('input').checked = options.month.startDayOfWeek;145 break;146 case 'toggle-workweek':147 options.month.workweek = !options.month.workweek;148 options.week.workweek = !options.week.workweek;149 viewName = cal.getViewName();150 target.querySelector('input').checked = !options.month.workweek;151 break;152 default:153 break;154 }155 cal.setOptions(options, true);156 cal.changeView(viewName, true);157 setDropdownCalendarType();158 setRenderRangeText();159 setSchedules();160 }161 // on click of next and previous button view change162 function onClickNavi(e) {163 var action = getDataAction(e.target);164 switch (action) {165 case 'move-prev':166 cal.prev();167 break;168 case 'move-next':169 cal.next();170 break;171 case 'move-today':172 cal.today();173 break;174 default:175 return;176 }177 setRenderRangeText();178 setSchedules();179 }180 // Click of new schedule button's open schedule create popup181 function createNewSchedule(event) {182 var start = event.start ? new Date(event.start.getTime()) : new Date();183 var end = event.end ? new Date(event.end.getTime()) : moment().add(1, 'hours').toDate();184 if (useCreationPopup) {185 cal.openCreationPopup({186 start: start,187 end: end188 });189 }190 }191 // new schedule create192 function saveNewSchedule(scheduleData) {193 var calendar = scheduleData.calendar || findCalendar(scheduleData.calendarId);194 var schedule = {195 id: String(chance.guid()),196 title: scheduleData.title,197 isAllDay: scheduleData.isAllDay,198 start: scheduleData.start,199 end: scheduleData.end,200 category: scheduleData.isAllDay ? 'allday' : 'time',201 dueDateClass: '',202 color: calendar.color,203 bgColor: calendar.bgColor,204 dragBgColor: calendar.bgColor,205 borderColor: calendar.borderColor,206 location: scheduleData.location,207 raw: {208 class: scheduleData.raw['class']209 },210 state: scheduleData.state211 };212 if (calendar) {213 schedule.calendarId = calendar.id;214 schedule.color = calendar.color;215 schedule.bgColor = calendar.bgColor;216 schedule.borderColor = calendar.borderColor;217 }218 cal.createSchedules([schedule]);219 refreshScheduleVisibility();220 }221 // view all checkbox initialize222 function onChangeCalendars(e) {223 var calendarId = e.target.value;224 var checked = e.target.checked;225 var viewAll = document.querySelector('.sidebar-calendars-item input');226 var calendarElements = Array.prototype.slice.call(document.querySelectorAll('#calendarList input'));227 var allCheckedCalendars = true;228 if (calendarId === 'all') {229 allCheckedCalendars = checked;230 calendarElements.forEach(function (input) {231 var span = input.parentNode;232 input.checked = checked;233 span.style.backgroundColor = checked ? span.style.borderColor : 'transparent';234 });235 CalendarList.forEach(function (calendar) {236 calendar.checked = checked;237 });238 } else {239 findCalendar(calendarId).checked = checked;240 allCheckedCalendars = calendarElements.every(function (input) {241 return input.checked;242 });243 if (allCheckedCalendars) {244 viewAll.checked = true;245 } else {246 viewAll.checked = false;247 }248 }249 refreshScheduleVisibility();250 }251 // schedule refresh according to view252 function refreshScheduleVisibility() {253 var calendarElements = Array.prototype.slice.call(document.querySelectorAll('#calendarList input'));254 CalendarList.forEach(function (calendar) {255 cal.toggleSchedules(calendar.id, !calendar.checked, false);256 });257 cal.render(true);258 calendarElements.forEach(function (input) {259 var span = input.nextElementSibling;260 span.style.backgroundColor = input.checked ? span.style.borderColor : 'transparent';261 });262 }263 // calendar type set on dropdown button264 function setDropdownCalendarType() {265 var calendarTypeName = document.getElementById('calendarTypeName');266 var calendarTypeIcon = document.getElementById('calendarTypeIcon');267 var options = cal.getOptions();268 var type = cal.getViewName();269 var iconClassName;270 if (type === 'day') {271 type = 'Daily';272 iconClassName = 'bx bx-calendar-alt mr-25';273 } else if (type === 'week') {274 type = 'Weekly';275 iconClassName = 'bx bx-calendar-event mr-25';276 } else if (options.month.visibleWeeksCount === 2) {277 type = '2 weeks';278 iconClassName = 'bx bx-calendar-check mr-25';279 } else if (options.month.visibleWeeksCount === 3) {280 type = '3 weeks';281 iconClassName = 'bx bx-calendar-check mr-25';282 } else {283 type = 'Monthly';284 iconClassName = 'bx bx-calendar mr-25';285 }286 calendarTypeName.innerHTML = type;287 calendarTypeIcon.className = iconClassName;288 }289 function setRenderRangeText() {290 var renderRange = document.getElementById('renderRange');291 var options = cal.getOptions();292 var viewName = cal.getViewName();293 var html = [];294 if (viewName === 'day') {295 html.push(moment(cal.getDate().getTime()).format('YYYY-MM-DD'));296 } else if (viewName === 'month' &&297 (!options.month.visibleWeeksCount || options.month.visibleWeeksCount > 4)) {298 html.push(moment(cal.getDate().getTime()).format('YYYY-MM'));299 } else {300 html.push(moment(cal.getDateRangeStart().getTime()).format('YYYY-MM-DD'));301 html.push('-');302 html.push(moment(cal.getDateRangeEnd().getTime()).format(' MM.DD'));303 }304 renderRange.innerHTML = html.join('');305 }306 // Randome Generated schedule307 function setSchedules() {308 cal.clear();309 generateSchedule(cal.getViewName(), cal.getDateRangeStart(), cal.getDateRangeEnd());310 cal.createSchedules(ScheduleList);311 refreshScheduleVisibility();312 }313 // Events initialize314 function setEventListener() {315 $('.menu-navigation').on('click', onClickNavi);316 $('.dropdown-menu [role="menuitem"]').on('click', onClickMenu);317 $('.sidebar-calendars').on('change', onChangeCalendars);318 $('.sidebar-new-schedule-btn').on('click', createNewSchedule);319 window.addEventListener('resize', resizeThrottled);320 }321 // get data-action atrribute's value322 function getDataAction(target) {323 return target.dataset ? target.dataset.action : target.getAttribute('data-action');324 }325 resizeThrottled = tui.util.throttle(function () {326 cal.render();327 }, 50);328 window.cal = cal;329 setDropdownCalendarType();330 setRenderRangeText();331 setSchedules();332 setEventListener();333})(window, tui.Calendar);334// set sidebar calendar list335(function () {336 var calendarList = document.getElementById('calendarList');337 var html = [];338 CalendarList.forEach(function (calendar) {339 html.push('<div class="sidebar-calendars-item"><label>' +340 '<input type="checkbox" class="tui-full-calendar-checkbox-round" value="' + calendar.id + '" checked>' +341 '<span style="border-color: ' + calendar.borderColor + '; background-color: ' + calendar.borderColor + ';"></span>' +342 '<span>' + calendar.name + '</span>' +343 '</label></div>'344 );345 });346 calendarList.innerHTML = html.join('\n');347})();348$(document).ready(function () {349 // calendar sidebar scrollbar350 if ($('.sidebar').length > 0) {351 var sidebar = new PerfectScrollbar(".sidebar", {352 wheelPropagation: false353 });354 }355 // sidebar menu toggle356 $(".sidebar-toggle-btn").on("click", function () {357 $(".sidebar").toggleClass("show");358 $(".app-content-overlay").toggleClass("show");359 })360 // on click Overlay hide sidebar and overlay361 $(".app-content-overlay, .sidebar-new-schedule-btn").on("click", function () {362 $(".sidebar").removeClass("show");363 $(".app-content-overlay").removeClass("show");364 });365})366$(window).on("resize", function () {367 // sidebar and overlay hide if screen resize368 if ($(window).width() < 991) {369 $(".sidebar").removeClass("show");370 $(".app-content-overlay").removeClass("show");371 }...

Full Screen

Full Screen

priceSchedules.js

Source:priceSchedules.js Github

copy

Full Screen

1angular.module( 'orderCloud' )2 .config( PriceSchedulesConfig )3 .controller( 'PriceSchedulesCtrl', PriceSchedulesController )4 .controller( 'PriceScheduleEditCtrl', PriceScheduleEditController )5 .controller( 'PriceScheduleCreateCtrl', PriceScheduleCreateController )6;7function PriceSchedulesConfig( $stateProvider ) {8 $stateProvider9 .state( 'priceSchedules', {10 parent: 'base',11 url: '/priceSchedules?search&page&pageSize&sortBy&searchOn&filters',12 templateUrl:'priceSchedules/templates/priceSchedules.tpl.html',13 controller:'PriceSchedulesCtrl',14 controllerAs: 'priceSchedules',15 data: {componentName: 'Price Schedules'},16 resolve: {17 Parameters: function( $stateParams, OrderCloudParameters ) {18 return OrderCloudParameters.Get($stateParams);19 },20 PriceScheduleList: function( OrderCloud, Parameters ) {21 return OrderCloud.PriceSchedules.List(Parameters.search, Parameters.page, Parameters.pageSize || 12, Parameters.searchOn, Parameters.sortBy, Parameters.filters);22 }23 }24 })25 .state( 'priceSchedules.edit', {26 url: '/:priceScheduleid/edit',27 templateUrl:'priceSchedules/templates/priceScheduleEdit.tpl.html',28 controller:'PriceScheduleEditCtrl',29 controllerAs: 'priceScheduleEdit',30 resolve: {31 SelectedPriceSchedule: function($stateParams, OrderCloud) {32 return OrderCloud.PriceSchedules.Get($stateParams.priceScheduleid);33 }34 }35 })36 .state( 'priceSchedules.create', {37 url: '/create',38 templateUrl:'priceSchedules/templates/priceScheduleCreate.tpl.html',39 controller:'PriceScheduleCreateCtrl',40 controllerAs: 'priceScheduleCreate'41 })42}43function PriceSchedulesController($state, $ocMedia, PriceScheduleList, OrderCloudParameters, OrderCloud, Parameters ) {44 var vm = this;45 vm.list = PriceScheduleList;46 vm.parameters = Parameters;47 vm.sortSelection = Parameters.sortBy ? (Parameters.sortBy.indexOf('!') == 0 ? Parameters.sortBy.split('!')[1] : Parameters.sortBy) : null;48 //Check if filters are applied49 vm.filtersApplied = vm.parameters.filters || ($ocMedia('max-width:767px') && vm.sortSelection); //Sort by is a filter on mobile devices50 vm.showFilters = vm.filtersApplied;51 //Check if search was used52 vm.searchResults = Parameters.search && Parameters.search.length > 0;53 //Reload the state with new parameters54 vm.filter = function(resetPage) {55 $state.go('.', OrderCloudParameters.Create(vm.parameters, resetPage));56 };57 //Reload the state with new search parameter & reset the page58 vm.search = function() {59 vm.filter(true);60 };61 //Clear the search parameter, reload the state & reset the page62 vm.clearSearch = function() {63 vm.parameters.search = null;64 vm.filter(true);65 };66 //Clear relevant filters, reload the state & reset the page67 vm.clearFilters = function() {68 vm.parameters.filters = null;69 $ocMedia('max-width:767px') ? vm.parameters.sortBy = null : angular.noop(); //Clear out sort by on mobile devices70 vm.filter(true);71 };72 //Conditionally set, reverse, remove the sortBy parameter & reload the state73 vm.updateSort = function(value) {74 value ? angular.noop() : value = vm.sortSelection;75 switch(vm.parameters.sortBy) {76 case value:77 vm.parameters.sortBy = '!' + value;78 break;79 case '!' + value:80 vm.parameters.sortBy = null;81 break82 default:83 vm.parameters.sortBy = value;84 }85 vm.filter(false);86 };87 //Used on mobile devices88 vm.reverseSort = function() {89 Parameters.sortBy.indexOf('!') == 0 ? vm.parameters.sortBy = Parameters.sortBy.split('!')[1] : vm.parameters.sortBy = '!' + Parameters.sortBy;90 vm.filter(false);91 };92 //Reload the state with the incremented page parameter93 vm.pageChanged = function() {94 $state.go('.', {page:vm.list.Meta.Page});95 };96 //Load the next page of results with all of the same parameters97 vm.loadMore = function() {98 return OrderCloud.PriceSchedules.List(Parameters.search, vm.list.Meta.Page + 1, Parameters.pageSize || vm.list.Meta.PageSize, Parameters.searchOn, Parameters.sortBy, Parameters.filters)99 .then(function(data) {100 vm.list.Items = vm.list.Items.concat(data.Items);101 vm.list.Meta = data.Meta;102 });103 };104}105function PriceScheduleEditController($scope, $exceptionHandler, $state, OrderCloud, SelectedPriceSchedule, PriceBreak, toastr ) {106 var vm = this,107 priceScheduleid = angular.copy(SelectedPriceSchedule.ID);108 vm.priceScheduleName = angular.copy(SelectedPriceSchedule.Name);109 vm.priceSchedule = SelectedPriceSchedule;110 vm.priceSchedule.MinQuantity =1;111 vm.addPriceBreak = function() {112 PriceBreak.addPriceBreak(vm.priceSchedule, vm.price, vm.quantity);113 vm.quantity = null;114 vm.price = null;115 };116 PriceBreak.addDisplayQuantity(vm.priceSchedule);117 vm.deletePriceBreak = PriceBreak.deletePriceBreak;118 vm.Submit = function() {119 vm.priceSchedule = PriceBreak.setMinMax(vm.priceSchedule);120 OrderCloud.PriceSchedules.Update(priceScheduleid, vm.priceSchedule)121 .then(function() {122 $state.go('priceSchedules', {}, {reload:true});123 toastr.success('Price Schedule Updated', 'Success');124 })125 .catch(function(ex) {126 $exceptionHandler(ex)127 });128 };129 vm.Delete = function() {130 OrderCloud.PriceSchedules.Delete(priceScheduleid)131 .then(function() {132 $state.go('priceSchedules', {}, {reload:true});133 toastr.success('Price Schedule Deleted', 'Success');134 })135 .catch(function(ex) {136 $exceptionHandler(ex)137 });138 };139 $scope.$watch(function() {140 return vm.priceSchedule.RestrictedQuantity;141 },function(value){142 if(vm.priceSchedule.RestrictedQuantity == true){143 vm.priceHeader = "Total Price";144 }else{145 vm.priceHeader = "Price Per Unit";146 }147 });148}149function PriceScheduleCreateController($scope, $exceptionHandler, $state, OrderCloud, PriceBreak,toastr) {150 var vm = this;151 vm.priceSchedule = {};152 vm.priceSchedule.RestrictedQuantity = false;153 vm.priceSchedule.PriceBreaks = new Array();154 vm.priceSchedule.MinQuantity =1;155 vm.priceSchedule.OrderType = 'Standard';156 vm.addPriceBreak = function() {157 PriceBreak.addPriceBreak(vm.priceSchedule, vm.price, vm.quantity);158 vm.quantity = null;159 vm.price = null;160 };161 vm.deletePriceBreak = PriceBreak.deletePriceBreak;162 vm.Submit = function() {163 vm.priceSchedule = PriceBreak.setMinMax(vm.priceSchedule);164 OrderCloud.PriceSchedules.Create(vm.priceSchedule)165 .then(function() {166 $state.go('priceSchedules', {}, {reload:true});167 toastr.success('Price Schedule Created', 'Success')168 })169 .catch(function(ex) {170 $exceptionHandler(ex)171 });172 }173 $scope.$watch(function() {174 return vm.priceSchedule.RestrictedQuantity;175 },function(value){176 if(vm.priceSchedule.RestrictedQuantity == true){177 vm.priceHeader = "Total Price";178 }else{179 vm.priceHeader = "Price Per Unit";180 }181 });...

Full Screen

Full Screen

priceSchedules.spec.js

Source:priceSchedules.spec.js Github

copy

Full Screen

1describe('Component: PriceSchedules', function() {2 var scope,3 q,4 priceSchedule,5 oc;6 beforeEach(module('orderCloud'));7 beforeEach(module('orderCloud.sdk'));8 beforeEach(inject(function($q, $rootScope,OrderCloud) {9 q = $q;10 scope = $rootScope.$new();11 priceSchedule = {12 ID: "TestPriceSchedule123456789",13 Name: "TestPriceSchedule123456789",14 ApplyTax: true,15 ApplyShipping: false,16 MinQuantity: null,17 MaxQuantity: null,18 UseCumulativeQuantity: false,19 RestrictedQuantity: false,20 OrderType: "Standard",21 PriceBreaks: [22 {23 Quantity: 1,24 Price: 5.025 }26 ]27 };28 oc = OrderCloud;29 }));30 describe('State: priceSchedules', function() {31 var state;32 beforeEach(inject(function($state) {33 state = $state.get('priceSchedules');34 spyOn(oc.PriceSchedules, 'List').and.returnValue(null);35 }));36 it('should resolve PriceScheduleList', inject(function ($injector) {37 $injector.invoke(state.resolve.PriceScheduleList);38 expect(oc.PriceSchedules.List).toHaveBeenCalled();39 }));40 });41 describe('State: priceSchedules.edit', function() {42 var state;43 beforeEach(inject(function($state) {44 state = $state.get('priceSchedules.edit');45 spyOn(oc.PriceSchedules, 'Get').and.returnValue(null);46 }));47 it('should resolve SelectedPriceSchedule', inject(function ($injector, $stateParams) {48 $injector.invoke(state.resolve.SelectedPriceSchedule);49 expect(oc.PriceSchedules.Get).toHaveBeenCalledWith($stateParams.priceScheduleid);50 }));51 });52 describe('Controller: PriceScheduleEditCtrl', function() {53 var priceScheduleEditCtrl;54 beforeEach(inject(function($state, $controller) {55 priceScheduleEditCtrl = $controller('PriceScheduleEditCtrl', {56 $scope: scope,57 SelectedPriceSchedule: priceSchedule58 });59 spyOn($state, 'go').and.returnValue(true);60 }));61 describe('addPriceBreak', function() {62 var quantity;63 var price;64 beforeEach(inject(function(PriceBreak) {65 priceScheduleEditCtrl.priceSchedule = priceSchedule;66 priceScheduleEditCtrl.quantity = quantity;67 priceScheduleEditCtrl.quantity = price;68 spyOn(PriceBreak, 'addPriceBreak').and.returnValue(null);69 priceScheduleEditCtrl.addPriceBreak();70 }));71 it ('should call the PriceBreak addPriceBreak method', inject(function(PriceBreak) {72 expect(PriceBreak.addPriceBreak).toHaveBeenCalledWith(priceSchedule, price, quantity);73 }));74 });75 describe('Submit', function() {76 beforeEach(function() {77 priceScheduleEditCtrl.priceSchedule = priceSchedule;78 priceScheduleEditCtrl.priceScheduleID = "TestPriceSchedule123456789";79 var defer = q.defer();80 defer.resolve(priceSchedule);81 spyOn(oc.PriceSchedules, 'Update').and.returnValue(defer.promise);82 priceScheduleEditCtrl.Submit();83 scope.$digest();84 });85 it ('should call the PriceSchedules Update method', function() {86 expect(oc.PriceSchedules.Update).toHaveBeenCalledWith(priceScheduleEditCtrl.priceScheduleID, priceScheduleEditCtrl.priceSchedule);87 });88 it ('should enter the priceSchedules state', inject(function($state) {89 expect($state.go).toHaveBeenCalledWith('priceSchedules', {}, {reload:true});90 }));91 });92 describe('Delete', function() {93 beforeEach(function() {94 var defer = q.defer();95 defer.resolve(priceSchedule);96 spyOn(oc.PriceSchedules, 'Delete').and.returnValue(defer.promise);97 priceScheduleEditCtrl.Delete();98 scope.$digest();99 });100 it ('should call the PriceSchedules Delete method', function() {101 expect(oc.PriceSchedules.Delete).toHaveBeenCalledWith(priceSchedule.ID);102 });103 it ('should enter the priceSchedules state', inject(function($state) {104 expect($state.go).toHaveBeenCalledWith('priceSchedules', {}, {reload:true});105 }));106 });107 });108 describe('Controller: PriceScheduleCreateCtrl', function() {109 var priceScheduleCreateCtrl;110 beforeEach(inject(function($state, $controller) {111 priceScheduleCreateCtrl = $controller('PriceScheduleCreateCtrl', {112 $scope: scope113 });114 spyOn($state, 'go').and.returnValue(true);115 }));116 describe('addPriceBreak', function() {117 var quantity;118 var price;119 beforeEach(inject(function(PriceBreak) {120 priceScheduleCreateCtrl.priceSchedule = priceSchedule;121 priceScheduleCreateCtrl.quantity = quantity;122 priceScheduleCreateCtrl.quantity = price;123 spyOn(PriceBreak, 'addPriceBreak').and.returnValue(null);124 priceScheduleCreateCtrl.addPriceBreak();125 }));126 it ('should call the PriceBreak addPriceBreak method', inject(function(PriceBreak) {127 expect(PriceBreak.addPriceBreak).toHaveBeenCalledWith(priceSchedule, price, quantity);128 }));129 });130 describe('Submit', function() {131 beforeEach(function() {132 priceScheduleCreateCtrl.priceSchedule = priceSchedule;133 var defer = q.defer();134 defer.resolve(priceSchedule);135 spyOn(oc.PriceSchedules, 'Create').and.returnValue(defer.promise);136 priceScheduleCreateCtrl.Submit();137 scope.$digest();138 });139 it ('should call the PriceSchedules Create method', function() {140 expect(oc.PriceSchedules.Create).toHaveBeenCalledWith(priceSchedule);141 });142 it ('should enter the priceSchedules state', inject(function($state) {143 expect($state.go).toHaveBeenCalledWith('priceSchedules', {}, {reload:true});144 }));145 });146 });...

Full Screen

Full Screen

schedules.js

Source:schedules.js Github

copy

Full Screen

1'use strict';2/*eslint-disable*/3var ScheduleList = [];4var SCHEDULE_CATEGORY = [5 'milestone',6 'task'7];8// constructor9function ScheduleInfo() {10 this.id = null;11 this.calendarId = null;12 this.title = null;13 this.body = null;14 this.isAllday = false;15 this.start = null;16 this.end = null;17 this.category = '';18 this.dueDateClass = '';19 this.color = null;20 this.bgColor = null;21 this.dragBgColor = null;22 this.borderColor = null;23 this.customStyle = '';24 this.isFocused = false;25 this.isPending = false;26 this.isVisible = true;27 this.isReadOnly = false;28 this.goingDuration = 0;29 this.comingDuration = 0;30 this.recurrenceRule = '';31 this.raw = {32 memo: '',33 hasToOrCc: false,34 hasRecurrenceRule: false,35 location: null,36 class: 'public', // or 'private'37 creator: {38 name: '',39 avatar: '',40 company: '',41 email: '',42 phone: ''43 }44 };45}46//time generate and create schedule47function generateTime(schedule, renderStart, renderEnd) {48 var startDate = moment(renderStart.getTime())49 var endDate = moment(renderEnd.getTime());50 var diffDate = endDate.diff(startDate, 'days');51 schedule.isAllday = chance.bool({ likelihood: 30 });52 if (schedule.isAllday) {53 schedule.category = 'allday';54 } else if (chance.bool({ likelihood: 30 })) {55 schedule.category = SCHEDULE_CATEGORY[chance.integer({ min: 0, max: 1 })];56 if (schedule.category === SCHEDULE_CATEGORY[1]) {57 schedule.dueDateClass = 'morning';58 }59 } else {60 schedule.category = 'time';61 }62 startDate.add(chance.integer({ min: 0, max: diffDate }), 'days');63 startDate.hours(chance.integer({ min: 0, max: 23 }))64 startDate.minutes(chance.bool() ? 0 : 30);65 schedule.start = startDate.toDate();66 endDate = moment(startDate);67 if (schedule.isAllday) {68 endDate.add(chance.integer({ min: 0, max: 3 }), 'days');69 }70 schedule.end = endDate71 .add(chance.integer({ min: 1, max: 4 }), 'hour')72 .toDate();73 if (!schedule.isAllday && chance.bool({ likelihood: 20 })) {74 schedule.goingDuration = chance.integer({ min: 30, max: 120 });75 schedule.comingDuration = chance.integer({ min: 30, max: 120 });76 if (chance.bool({ likelihood: 50 })) {77 schedule.end = schedule.start;78 }79 }80}81// randome name generate82function generateNames() {83 var names = [];84 var i = 0;85 var length = chance.integer({ min: 1, max: 10 });86 for (i; i < length; i += 1) {87 names.push(chance.name({ nationality: 'en' }));88 }89 return names;90}91// generate randome schedule92function generateRandomSchedule(calendar, renderStart, renderEnd) {93 var schedule = new ScheduleInfo();94 schedule.id = chance.guid();95 schedule.calendarId = calendar.id;96 schedule.title = chance.name({ nationalty: 'en' });97 schedule.body = chance.bool({ likelihood: 20 }) ? chance.sentence({ words: 10 }) : '';98 schedule.isReadOnly = chance.bool({ likelihood: 20 });99 generateTime(schedule, renderStart, renderEnd);100 schedule.isPrivate = chance.bool({ likelihood: 10 });101 schedule.location = chance.address();102 schedule.attendees = chance.bool({ likelihood: 70 }) ? generateNames() : [];103 schedule.recurrenceRule = chance.bool({ likelihood: 20 }) ? 'repeated events' : '';104 schedule.color = calendar.color;105 schedule.bgColor = calendar.bgColor;106 schedule.dragBgColor = calendar.dragBgColor;107 schedule.borderColor = calendar.borderColor;108 if (schedule.category === 'milestone') {109 schedule.color = schedule.bgColor;110 schedule.bgColor = 'transparent';111 schedule.dragBgColor = 'transparent';112 schedule.borderColor = 'transparent';113 }114 schedule.raw.memo = chance.sentence();115 schedule.raw.creator.name = chance.name();116 schedule.raw.creator.avatar = chance.avatar();117 schedule.raw.creator.company = chance.company();118 schedule.raw.creator.email = chance.email();119 schedule.raw.creator.phone = chance.phone();120 if (chance.bool({ likelihood: 20 })) {121 var travelTime = chance.minute();122 schedule.goingDuration = travelTime;123 schedule.comingDuration = travelTime;124 }125 ScheduleList.push(schedule);126}127// random schedule created128function generateSchedule(viewName, renderStart, renderEnd) {129 ScheduleList = [];130 CalendarList.forEach(function (calendar) {131 var i = 0, length = 1;132 if (viewName === 'month') {133 length = 1;134 } else if (viewName === 'day') {135 length = 2;136 }137 for (i; i < length; i += 1) {138 generateRandomSchedule(calendar, renderStart, renderEnd);139 }140 });...

Full Screen

Full Screen

osem-schedule.js

Source:osem-schedule.js Github

copy

Full Screen

1var url; // Should be initialize in Schedule.initialize2var schedule_id; // Should be initialize in Schedule.initialize3function showError(error){4 // Delete other error messages before showing the new one5 $('.unobtrusive-flash-container').empty();6 UnobtrusiveFlash.showFlashMessage(error, {type: 'error'});7}8var Schedule = {9 initialize: function(url_param, schedule_id_param) {10 url = url_param;11 schedule_id = schedule_id_param;12 },13 remove: function(element) {14 var e = $("#" + element);15 var event_schedule_id = e.attr("event_schedule_id");16 if(event_schedule_id != null){17 var my_url = url + '/' + event_schedule_id;18 var success_callback = function(data) {19 e.attr("event_schedule_id", null);20 e.appendTo($(".unscheduled-events"));21 e.find(".schedule-event-delete-button").hide();22 }23 var error_callback = function(data) {24 showError($.parseJSON(data.responseText).errors);25 }26 $.ajax({27 url: my_url,28 type: 'DELETE',29 success: success_callback,30 error: error_callback,31 dataType : 'json'32 });33 }34 else{35 showError("The event couldn't be unscheduled");36 }37 },38 add: function (previous_parent, new_parent, event) {39 event.appendTo(new_parent);40 var event_schedule_id = event.attr("event_schedule_id");41 var my_url = url;42 var type = 'POST';43 var params = { event_schedule: {44 room_id: new_parent.attr("room_id"),45 start_time: (new_parent.attr("date") + ' ' + new_parent.attr("hour"))46 }};47 if(event_schedule_id != null){48 type = 'PUT';49 my_url += ('/' + event_schedule_id);50 }51 else{52 params['event_schedule']['event_id'] = event.attr("event_id");53 params['event_schedule']['schedule_id'] = schedule_id;54 }55 var success_callback = function(data) {56 event.attr("event_schedule_id", data.event_schedule_id);57 event.find(".schedule-event-delete-button").show();58 }59 var error_callback = function(data) {60 showError($.parseJSON(data.responseText).errors);61 event.appendTo(previous_parent);62 }63 $.ajax({64 url: my_url,65 type: type,66 data: params,67 success: success_callback,68 error: error_callback,69 dataType : 'json'70 });71 }72};73$(document).ready( function() {74 // hide the remove button for unscheduled and non schedulable events75 $('.unscheduled-events .schedule-event-delete-button').hide();76 $('.non_schedulable .schedule-event-delete-button').hide();77 // set events as draggable78 $('.schedule-event').not('.non_schedulable').draggable({79 snap: '.schedule-room-slot',80 revertDuration: 200,81 revert: function (event, ui) {82 return !event;83 },84 stop: function(event, ui) {85 this._originalPosition = this._originalPosition || ui.originalPosition;86 ui.helper.animate( this._originalPosition );87 },88 opacity: 0.7,89 snapMode: "inner",90 zIndex: 2,91 scroll: true92 });93 // set room cells as droppable94 $('.schedule-room-slot').not('.non_schedulable .schedule-room-slot').droppable({95 accept: '.schedule-event',96 tolerance: "pointer",97 drop: function(event, ui) {98 $(ui.draggable).css("left", 0);99 $(ui.draggable).css("top", 0);100 $(this).css("background-color", "#ffffff");101 Schedule.add($(ui.draggable).parent(), $(this), $(ui.draggable));102 },103 over: function(event, ui) {104 $(this).css("background-color", "#009ED8");105 },106 out: function(event, ui) {107 $(this).css("background-color", "#ffffff");108 }109 });110});111function eventClicked(e, element){112 var url = $(element).data('url');113 if(e.ctrlKey)114 window.open(url,'_blank');115 else116 window.location = url;117}118/* Links inside event-panel (to make ctrl + click work for these links):119 = link_to text, '#', onClick: 'insideLinkClicked();', 'data-url' => url120*/121function insideLinkClicked(event){122 // stops the click from propagating123 if (!event) // for IE124 var event = window.event;125 event.cancelBubble = true;126 if (event.stopPropagation) event.stopPropagation();127 var url = $(event.target).data('url');128 if(event.ctrlKey)129 window.open(url,'_blank');130 else131 window.location = url;...

Full Screen

Full Screen

priceBreakService.js

Source:priceBreakService.js Github

copy

Full Screen

1angular.module('orderCloud')2 .factory('PriceBreak', PriceBreakFactory);3function PriceBreakFactory (Underscore,toastr) {4 var service = {5 addPriceBreak : addPriceBreak,6 setMinMax: setMinMax,7 deletePriceBreak: deletePriceBreak,8 addDisplayQuantity:addDisplayQuantity9 };10 function setMinMax(priceSchedule) {11 var quantities = _.pluck(priceSchedule.PriceBreaks, 'Quantity');12 priceSchedule.MinQuantity = _.min(quantities);13 if (priceSchedule.RestrictedQuantity) {14 priceSchedule.MaxQuantity = _.max(quantities);15 }16 return priceSchedule;17 }18 function addPriceBreak( priceSchedule, price, quantity) {19 var numberExist = Underscore.findWhere(priceSchedule.PriceBreaks, {Quantity: quantity});20 if (quantity > priceSchedule.MaxQuantity){21 toastr.error('Max quantity exceeded','Error');22 }else{23 numberExist === undefined ? priceSchedule.PriceBreaks.push({Price: price, Quantity: quantity}):toastr.error('Quantity already exists , please delete. re-enter quantity and price to edit','Error');24 }25 displayQuantity(priceSchedule);26 return setMinMax(priceSchedule);27 }28 function addDisplayQuantity(priceSchedule){29 displayQuantity(priceSchedule);30 return setMinMax(priceSchedule);31 }32 function deletePriceBreak(priceSchedule, index) {33 priceSchedule.PriceBreaks.splice(index, 1);34 return setMinMax(priceSchedule);35 }36 function displayQuantity(priceSchedule){37 //Organize the priceschedule array in order of quantity38 priceSchedule.PriceBreaks.sort(function(a,b){return a.Quantity - b.Quantity});39 //find out the max quantity in the array40 var maxQuantity = Math.max.apply(Math,priceSchedule.PriceBreaks.map(function(object){return object.Quantity}));41 // go through each item in the priceschedule array42 for(var i=0; i < priceSchedule.PriceBreaks.length; i++) {43 //if max number is unique, display max number with + symbol44 if (priceSchedule.PriceBreaks[i].Quantity == maxQuantity) {45 priceSchedule.PriceBreaks[i].displayQuantity = priceSchedule.PriceBreaks[i].Quantity + "+";46 } else {47 //otherwise get the range of numbers between the current index quantity , and the next index Quantity48 var itemQuantityRange = Underscore.range(priceSchedule.PriceBreaks[i].Quantity, priceSchedule.PriceBreaks[i + 1].Quantity);49 itemQuantityRange;50 // If the difference between the range of numbers is only 1 . then just display that quantity number51 if (itemQuantityRange.length === 1) {52 priceSchedule.PriceBreaks[i].displayQuantity = itemQuantityRange[0];53 } else {54 //the last quantity in the array of PriceBreaks minus the 1st quantity in the calculate range is less than or =1 , add only the first number in the Item55 if (((priceSchedule.PriceBreaks[priceSchedule.PriceBreaks.length - 1]).Quantity - itemQuantityRange[0]) <= 1) {56 priceSchedule.PriceBreaks[i].displayQuantity = itemQuantityRange[0];57 //displays range between two quantities in the array58 } else {59 priceSchedule.PriceBreaks[i].displayQuantity = itemQuantityRange[0] + "-" + itemQuantityRange[itemQuantityRange.length - 1];60 }61 }62 }63 }64 }65 return service;...

Full Screen

Full Screen

Schedule.js

Source:Schedule.js Github

copy

Full Screen

1import React, { Component } from 'react';2import _ from 'lodash';3import axios from 'axios';4import PropTypes from 'prop-types';5import { connect } from 'react-redux';6import { loginUser } from '../../actions/authActions';7import CreateSchedule from './CreateSchedule';8import { FadeLoader } from 'react-spinners';9import { css } from '@emotion/core';10const override = css`11 display: block;12 margin: auto;13 margin-top: 20%;14 border-color: #03728b;15`;16class Schedule extends Component {17 constructor(props) {18 super(props);19 this.state = {20 schedule: {},21 hasSchedule: false,22 };23 }24 componentDidMount() {}25 renderDay = (day) => {26 return (27 <React.Fragment>28 <div className="schedule-day">{day}</div>29 <div className="schedule-content">30 {this.props.schedule[day].map((item, index) => {31 return (32 <div key={index} className="schedule-item">33 <div>{item.name}</div>34 <div className="schedule-item-time">{item.startTs_endTs}</div>35 </div>36 );37 })}38 </div>39 </React.Fragment>40 );41 };42 sendSchedule = (schedule) => {43 const data = {44 schedule,45 id: this.props.userId,46 };47 axios48 .post('/api/users/schedule', data)49 .then((result) => {50 window.location.reload();51 })52 .catch(function (error) {});53 };54 render() {55 return this.state.loading ? (56 <div className="sweet-loading">57 <FadeLoader css={override} sizeUnit={'px'} size={150} color={'#03728b'} loading={this.state.loading} />58 </div>59 ) : this.props.hasSchedule ? (60 <React.Fragment>61 <div className="quizes-list-header">Orar</div>62 <br />63 <br />64 <div className="row row-schedule justify-content-center">65 <div className="col-md-2 col-md-offset-1 col-schedule">{this.renderDay('luni')}</div>66 <div className="col-md-2 col-schedule">{this.renderDay('marti')}</div>67 <div className="col-md-2 col-schedule">{this.renderDay('miercuri')}</div>68 <div className="col-md-2 col-schedule">{this.renderDay('joi')}</div>69 <div className="col-md-2 col-schedule">{this.renderDay('vineri')}</div>70 </div>71 </React.Fragment>72 ) : (73 <CreateSchedule sendSchedule={this.sendSchedule} />74 );75 }76}77Schedule.propTypes = {78 auth: PropTypes.object.isRequired,79};80const mapStateToProps = (state) => ({81 auth: state.auth,82});...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { schedule } = require('fast-check-monorepo')2schedule(async () => {3})4const { schedule } = require('fast-check-monorepo')5schedule(async () => {6})7const { schedule } = require('fast-check-monorepo')8schedule(async () => {9})10const { schedule } = require('fast-check-monorepo')11schedule(async () => {12})13const { schedule } = require('fast-check-monorepo')14schedule(async () => {15})16const { schedule } = require('fast-check-monorepo')17schedule(async () => {18})19const { schedule } = require('fast-check-monorepo')20schedule(async () => {21})22const { schedule } = require('fast-check-monorepo')23schedule(async () => {24})25const { schedule } = require('fast-check-monorepo')26schedule(async () => {27})28const { schedule } = require('fast-check-monorepo')29schedule(async () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { schedule } from 'fast-check-monorepo'2import { pipe } from 'fp-ts/lib/function'3import * as O from 'fp-ts/lib/Option'4const result = pipe(5 schedule(6 { seed: 42, path: 'test.js', timeout: 1000 },7 {8 async: () => Promise.resolve(O.some(42)),9 sync: () => O.some(42),10 }11 (r) => {12 console.log(r)13 }

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2const { schedule } = require('fast-check-monorepo');3const { run } = require('fast-check-monorepo');4const fc = require('fast-check');5const { schedule } = require('fast-check-monorepo');6const { run } = require('fast-check-monorepo');7const fc = require('fast-check');8const { schedule } = require('fast-check-monorepo');9const { run } = require('fast-check-monorepo');10const fc = require('fast-check');11const { schedule } = require('fast-check-monorepo');12const { run } = require('fast-check-monorepo');13const fc = require('fast-check');14const { schedule } = require('fast-check-monorepo');15const { run } = require('fast-check-monorepo');16const fc = require('fast-check');17const { schedule } = require('fast-check-monorepo');18const { run } = require('fast-check-monorepo');19const fc = require('fast-check');20const { schedule } = require('fast-check-monorepo');21const { run } = require('fast-check-monorepo');22const fc = require('fast-check');23const { schedule } = require('fast-check-monorepo');24const { run } = require('fast-check-monorepo');25const fc = require('fast-check');26const { schedule } = require('fast-check-monorepo');27const { run } = require('fast-check-monorepo');28const fc = require('fast-check');29const { schedule } = require('fast-check-monorepo');30const { run } = require('fast-check-monorepo');31const fc = require('fast-check');32const { schedule } = require('fast-check-monorepo');33const { run } = require('

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2const { schedule } = require('fast-check/lib/schedule/Schedule');3const s = schedule({4 run: () => {5 console.log('Running');6 },7 init: () => {8 console.log('Init');9 },10 dispose: () => {11 console.log('Dispose');12 },13});14fc.assert(15 fc.property(fc.integer(), fc.integer(), (a, b) => {16 return a + b === b + a;17 }),18 { verbose: true, seed: 42, path: 'test.js', endOnFailure: true, schedule: s }19);

Full Screen

Using AI Code Generation

copy

Full Screen

1const fastCheck = require('fast-check');2const schedule = fastCheck.schedule;3const { run } = schedule();4const { check, property } = require('fast-check');5const arb = fastCheck.integer(0, 100);6const prop = property(arb, (n) => {7 console.log(`n = ${n}`);8 return n >= 0 && n <= 100;9});10run(100, prop, { verbose: 1 });

Full Screen

Using AI Code Generation

copy

Full Screen

1const schedule = require('fast-check-monorepo').schedule;2schedule((fc, run) => {3}, {4});5{6 "scripts": {7 }8}9{10}11{12}

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fast-check-monorepo automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful