v
This commit is contained in:
1 parent
618d55fcd5
commit
85ef48aae0
71 files changed
+89
-82
No files matched your search
@@ -0,0 +1,7 @@
|
||||
import{d as qt,r as O,U as ue,_ as ae,s as L,t as z,v as f,x as u,B as Kt,y as W,$ as Z,V as Se,cG as te,C as Bt,c3 as Gt,F as Zt,A as ne,a0 as De,K as xt,l as Ie,f as H,dn as Jt,cS as et,M as ce,a3 as ke,Z as Xt,z as Ee,R as fe,S as be,T as Re,dp as je,a2 as Tt,Q as G,cR as lt,aP as Le,E as k,d2 as Qt,D as P,Y as St,W as Be,a4 as $t,L as Ct,aL as en,G as tn,H as nn,q as an,w as rn}from"./index-f3f24177.js";import{V as on}from"./VForm-36904946.js";import{V as Me}from"./VCheckboxBtn-53ca7935.js";import{a as ln}from"./VList-983e49dd.js";import{V as Ne}from"./VAutocomplete-383dbedc.js";import{V as xe}from"./VTextarea-d04410cf.js";import{V as tt}from"./VLocaleProvider-7ac59f8a.js";import{V as Ot}from"./VDatePicker-783de65a.js";import{V as sn}from"./VFileInput-b0d8c050.js";import{V as Ut}from"./VTextField-2c3c89ba.js";import{b as dn,c as un,a as cn,V as fn}from"./VExpansionPanels-203409e8.js";import"./VInput-3de7b4b2.js";import"./VSelectionControl-9e0e68f5.js";import"./ssrBoot-4527a6ac.js";import"./VSelect-9ace525e.js";import"./VVirtualScroll-82048add.js";/* empty css */import"./VField-ac1e4507.js";import"./VSpacer-9ba25539.js";const yn=qt("weekends",()=>{const n=O({});function e(a){ue.get(`api/calendar_of_events/exclusion_dates/?year=${a}`,{}).then(t=>{n.value=t.data})}return{week:n,getWeekend:e}}),hn={props:{title:{type:String,default:""},newOrOld:{type:Boolean,default:!1}},setup(n,{emit:e}){const a=O(null);return{form_valid:a,transformation:()=>{e("postData",a.value.isValid)},clearFormValidation:()=>{a.value&&a.value.resetValidation()}}}};function vn(n,e,a,t,r,l){return L(),z(xt,{"min-height":"436",class:"pa-3"},{default:f(()=>[u(Kt,{class:"pr-0 pl-2 d-flex justify-space-between"},{default:f(()=>[W(Z(a.title)+" ",1),u(Se,{icon:"mdi-close cursor-pointer",size:"small",color:"grey",onClick:e[0]||(e[0]=s=>n.$emit("closeDialog"))})]),_:1}),u(on,{ref:"form_valid",onSubmit:te(t.transformation,["prevent"])},{default:f(()=>[u(Bt,{class:"d-flex px-3"},{default:f(()=>[Gt(n.$slots,"card_text")]),_:3}),u(Zt,{class:"justify-end"},{default:f(()=>[a.newOrOld?De("",!0):(L(),z(ne,{key:0,icon:"mdi-delete",variant:"tonal",rounded:"",size:"36px",onClick:e[1]||(e[1]=s=>n.$emit("delObject"))})),u(ne,{class:"text-subtitle-1",elevation:"0",width:"150",onClick:e[2]||(e[2]=s=>n.$emit("closeDialog")),color:"btn_gray",variant:"flat"},{default:f(()=>[W("Отменить")]),_:1}),u(ne,{class:"text-subtitle-1 font-weight-regular",color:"btn_text",variant:"flat",elevation:"0",width:"150",type:"transformation"},{default:f(()=>[W(Z(a.newOrOld?"Создать":"Редактировать"),1)]),_:1})]),_:1})]),_:3},8,["onSubmit"])]),_:3})}const Mt=ae(hn,[["render",vn]]);const mn={props:{staff:{type:Array,default:()=>[]},okey:{type:String,default:"selected"}},setup(n,{emit:e}){const a=O(""),t=Ie(),r=O([]),l=H({get(){if(n.okey=="editor"){let d=[];return n.staff.forEach(y=>{let p={...y};p.employees=y.employees.filter(T=>T.selected==!0),p.employees.length>0&&d.push(p)}),d.forEach(y=>{y.employees.every(p=>p.editor==!0)&&(y.editor=!0)}),d}return n.staff}}),s=H({get(){let d=[];return n.staff.forEach(y=>{y.employees.length!=1&&y.employees.every(p=>p[n.okey]==!0)?(y[n.okey]=!0,d.push(y)):y.employees.length==1?(y[n.okey]=!0,d.push(...y.employees.filter(p=>p[n.okey]==!0))):(y[n.okey]=!1,d.push(...y.employees.filter(p=>p[n.okey]==!0)))}),d},set(d){Array.isArray(d)||i(d)}}),i=d=>{if("employees"in d)d.employees.forEach(y=>{y.id!=t.user.is_idEmployee&&(y[n.okey]=!d[n.okey])}),e("returnIdParticant",{okey:n.okey,staff:d.employees,select:[]});else if(d.length){if(d[0].id!=t.user.is_idEmployee){let y=!d.every(p=>p[n.okey]==!0);o(d,y),e("returnIdParticant",{okey:n.okey,staff:r.value,select:[]}),r.value=[]}}else d[n.okey]=!d[n.okey],e("returnIdParticant",{okey:n.okey,staff:[d],select:[]})},o=(d,y)=>{d.forEach(p=>{p.id!=t.user.is_idEmployee&&(p[n.okey]=y),"employees"in p||r.value.push(p),"employees"in p&&o(p.employees,y)})};function c(d,y){return d.includes(a.value)||y.raw.employees.some(p=>p.title.toLowerCase().includes(a.value.toLowerCase()))}return{staffed:l,filtered:a,accountStore:t,selectedStaff:s,splitname:Jt,onFilter:c,disable:d=>d.id==t.user.id_dict_department&&d.employees.length==1,allUser:()=>{i(l.value)}}}},pn=ce("span",{class:"text-body-2"}," ВСЕ СОТРУДНИКИ ",-1),bn={class:"text-body-2"};function wn(n,e,a,t,r,l){return L(),z(Ne,{modelValue:t.selectedStaff,"onUpdate:modelValue":e[2]||(e[2]=s=>t.selectedStaff=s),items:t.staffed,label:"Выберите из списка или найдите по ФИО","item-title":"title","item-value":"id","custom-filter":t.onFilter,"onUpdate:search":e[3]||(e[3]=s=>t.filtered=s),multiple:"","hide-details":"",variant:"outlined",density:"compact",class:"max-height-select py-3","return-object":""},{selection:f(({item:s})=>[u(et,{class:"me-2",color:"teal-darken-3",size:"small",label:""},{default:f(()=>[ce("span",null,Z(s.title),1),s.value!=t.accountStore.user.is_idEmployee?(L(),z(Se,{key:0,icLine truncated
|
||||
`).map(Zn).filter(function(a){return a!==null});return Q(Q({},e[0]),e[1])}function ze(n){var e={},a=/DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(n);if(!a)return e;var t=a[1],r=a[2];return t&&(e.tzid=t),e.dtstart=at(r),e}function Zn(n){if(n=n.replace(/^\s+|\s+$/,""),!n.length)return null;var e=/^([A-Z]+?)[:;]/.exec(n.toUpperCase());if(!e)return ht(n);var a=e[1];switch(a.toUpperCase()){case"RRULE":case"EXRULE":return ht(n);case"DTSTART":return ze(n);default:throw new Error("Unsupported RFC prop ".concat(a," in ").concat(n))}}function ht(n){var e=n.replace(/^RRULE:/i,""),a=ze(e),t=n.replace(/^(?:RRULE|EXRULE):/i,"").split(";");return t.forEach(function(r){var l=r.split("="),s=l[0],i=l[1];switch(s.toUpperCase()){case"FREQ":a.freq=Y[i.toUpperCase()];break;case"WKST":a.wkst=ee[i.toUpperCase()];break;case"COUNT":case"INTERVAL":case"BYSETPOS":case"BYMONTH":case"BYMONTHDAY":case"BYYEARDAY":case"BYWEEKNO":case"BYHOUR":case"BYMINUTE":case"BYSECOND":var o=Jn(i),c=s.toLowerCase();a[c]=o;break;case"BYWEEKDAY":case"BYDAY":a.byweekday=Xn(i);break;case"DTSTART":case"TZID":var v=ze(n);a.tzid=v.tzid,a.dtstart=v.dtstart;break;case"UNTIL":a.until=at(i);break;case"BYEASTER":a.byeaster=Number(i);break;default:throw new Error("Unknown RRULE property '"+s+"'")}}),a}function Jn(n){if(n.indexOf(",")!==-1){var e=n.split(",");return e.map(vt)}return vt(n)}function vt(n){return/^[+-]?\d+$/.test(n)?Number(n):n}function Xn(n){var e=n.split(",");return e.map(function(a){if(a.length===2)return ee[a];var t=a.match(/^([+-]?\d{1,2})([A-Z]{2})$/);if(!t||t.length<3)throw new SyntaxError("Invalid weekday string: ".concat(a));var r=Number(t[1]),l=t[2],s=ee[l].weekday;return new B(s,r)})}var He=function(){function n(e,a){if(isNaN(e.getTime()))throw new RangeError("Invalid date passed to DateWithZone");this.date=e,this.tzid=a}return Object.defineProperty(n.prototype,"isUTC",{get:function(){return!this.tzid||this.tzid.toUpperCase()==="UTC"},enumerable:!1,configurable:!0}),n.prototype.toString=function(){var e=nt(this.date.getTime(),this.isUTC);return this.isUTC?":".concat(e):";TZID=".concat(this.tzid,":").concat(e)},n.prototype.getTime=function(){return this.date.getTime()},n.prototype.rezonedDate=function(){return this.isUTC?this.date:Pn(this.date,this.tzid)},n}();function $e(n){for(var e=[],a="",t=Object.keys(n),r=Object.keys(it),l=0;l<t.length;l++)if(t[l]!=="tzid"&&A(r,t[l])){var s=t[l].toUpperCase(),i=n[t[l]],o="";if(!(!F(i)||X(i)&&!i.length)){switch(s){case"FREQ":o=g.FREQUENCIES[n.freq];break;case"WKST":ie(i)?o=new B(i).toString():o=i.toString();break;case"BYWEEKDAY":s="BYDAY",o=Ln(i).map(function(y){return y instanceof B?y:X(y)?new B(y[0],y[1]):new B(y)}).toString();break;case"DTSTART":a=Qn(i,n.tzid);break;case"UNTIL":o=nt(i,!n.tzid);break;default:if(X(i)){for(var c=[],v=0;v<i.length;v++)c[v]=String(i[v]);o=c.toString()}else o=String(i)}o&&e.push([s,o])}}var h=e.map(function(y){var p=y[0],T=y[1];return"".concat(p,"=").concat(T.toString())}).join(";"),d="";return h!==""&&(d="RRULE:".concat(h)),[a,d].filter(function(y){return!!y}).join(`
|
||||
`)}function Qn(n,e){return n?"DTSTART"+new He(new Date(n),e).toString():""}function $n(n,e){return Array.isArray(n)?!Array.isArray(e)||n.length!==e.length?!1:n.every(function(a,t){return a.getTime()===e[t].getTime()}):n instanceof Date?e instanceof Date&&n.getTime()===e.getTime():n===e}var ea=function(){function n(){this.all=!1,this.before=[],this.after=[],this.between=[]}return n.prototype._cacheAdd=function(e,a,t){a&&(a=a instanceof Date?Je(a):ut(a)),e==="all"?this.all=a:(t._value=a,this[e].push(t))},n.prototype._cacheGet=function(e,a){var t=!1,r=a?Object.keys(a):[],l=function(v){for(var h=0;h<r.length;h++){var d=r[h];if(!$n(a[d],v[d]))return!0}return!1},s=this[e];if(e==="all")t=this.all;else if(X(s))for(var i=0;i<s.length;i++){var o=s[i];if(!(r.length&&l(o))){t=o._value;break}}if(!t&&this.all){for(var c=new _e(e,a),i=0;i<this.all.length&&c.accept(this.all[i]);i++);t=c.getValue(),this._cacheAdd(e,t,a)}return X(t)?ut(t):t instanceof Date?Je(t):t},n}(),ta=m(m(m(m(m(m(m(m(m(m(m(m(m([],M(1,31),!0),M(2,28),!0),M(3,31),!0),M(4,30),!0),M(5,31),!0),M(6,30),!0),M(7,31),!0),M(8,31),!0),M(9,30),!0),M(10,31),!0),M(11,30),!0),M(12,31),!0),M(1,7),!0),na=m(m(m(m(m(m(m(m(m(m(m(m(m([],M(1,31),!0),M(2,29),!0),M(3,31),!0),M(4,30),!0),M(5,31),!0),M(6,30),!0),M(7,31),!0),M(8,31),!0),M(9,30),!0),M(10,31),!0),M(11,30),!0),M(12,31),!0),M(1,7),!0),aa=se(1,29),ra=se(1,30),he=se(1,31),q=se(1,32),oa=m(m(m(m(m(m(m(m(m(m(m(m(m([],q,!0),ra,!0),q,!0),he,!0),q,!0),he,!0),q,!0),q,!0),he,!0),q,!0),he,!0),q,!0),q.slice(0,7),!0),ia=m(m(m(m(m(m(m(m(m(m(m(m(m([],q,!0),aa,!0),q,!0),he,!0),q,!0),he,!0),q,!0),q,!0),he,!0),q,!0),he,!0),q,!0),q.slice(0,7),!0),la=se(-28,0),sa=se(-29,0),ve=se(-30,0),K=se(-31,0),da=m(m(m(m(m(m(m(m(m(m(m(m(m([],K,!0),sa,!0),K,!0),ve,!0),K,!0),ve,!0),K,!0),K,!0),ve,!0),K,!0),ve,!0),K,!0),K.slice(0,7),!0),ua=m(m(m(m(m(m(m(m(m(m(m(m(m([],K,!0),la,!0),K,!0),ve,!0),K,!0),ve,!0),K,!0),K,!0),ve,!0),K,!0),ve,!0),K,!0),K.slice(0,7),!0),ca=[0,31,60,91,121,152,182,213,244,274,305,335,366],fa=[0,31,59,90,120,151,181,212,243,273,304,334,365],mt=function(){for(var n=[],e=0;e<55;e++)n=n.concat(se(7));return n}();function ya(n,e){var a=we(n,1,1),t=Ye(n)?366:365,r=Ye(n+1)?366:365,l=Ze(a),s=Te(a),i=Q(Q({yearlen:t,nextyearlen:r,yearordinal:l,yearweekday:s},ha(n)),{wnomask:null});if(le(e.byweekno))return i;i.wnomask=M(0,t+7);var o,c,v=o=$(7-s+e.wkst,7);v>=4?(v=0,c=i.yearlen+$(s-e.wkst,7)):c=t-v;for(var h=Math.floor(c/7),d=$(c,7),y=Math.floor(h+d/4),p=0;p<e.byweekno.length;p++){var T=e.byweekno[p];if(T<0&&(T+=y+1),T>0&&T<=y){var S=void 0;T>1?(S=v+(T-1)*7,v!==o&&(S-=7-o)):S=v;for(var b=0;b<7&&(i.wnomask[S]=1,S++,i.wdaymask[S]!==e.wkst);b++);}}if(A(e.byweekno,1)){var S=v+y*7;if(v!==o&&(S-=7-o),S<t)for(var p=0;p<7&&(i.wnomask[S]=1,S+=1,i.wdaymask[S]!==e.wkst);p++);}if(v){var C=void 0;if(A(e.byweekno,-1))C=-1;else{var I=Te(we(n-1,1,1)),E=$(7-I.valueOf()+e.wkst,7),_=Ye(n-1)?366:365,x=void 0;E>=4?(E=0,x=_+$(I-e.wkst,7)):x=t-v,C=Math.floor(52+$(x,7)/4)}if(A(e.byweekno,C))for(var S=0;S<v;S++)i.wnomask[S]=1}return i}function ha(n){var e=Ye(n)?366:365,a=we(n,1,1),t=Te(a);return e===365?{mmask:ta,mdaymask:ia,nmdaymask:ua,wdaymask:mt.slice(t),mrange:fa}:{mmask:na,mdaymask:oa,nmdaymask:da,wdaymask:mt.slice(t),mrange:ca}}function va(n,e,a,t,r,l){var s={lastyear:n,lastmonth:e,nwdaymask:[]},i=[];if(l.freq===g.YEARLY)if(le(l.bymonth))i=[[0,a]];else for(var o=0;o<l.bymonth.length;o++)e=l.bymonth[o],i.push(t.slice(e-1,e+1));else l.freq===g.MONTHLY&&(i=[t.slice(e-1,e+1)]);if(le(i))return s;s.nwdaymask=M(0,a);for(var o=0;o<i.length;o++)for(var c=i[o],v=c[0],h=c[1]-1,d=0;d<l.bynweekday.length;d++){var y=void 0,p=l.bynweekday[d],T=p[0],S=p[1];S<0?(y=h+(S+1)*7,y-=$(r[y]-T,7)):(y=v+(S-1)*7,y+=$(7-r[y]+T,7)),v<=y&&y<=h&&(s.nwdaymask[y]=1)}return s}function ma(n,e){e===void 0&&(e=0);var a=n%19,t=Math.floor(n/100),r=n%100,l=Math.floor(t/4),s=t%4,i=Math.floor((t+8)/25),o=Math.floor((t-i+1)/3),c=Math.floor(19*a+t-l-o+15)%30,v=Math.floor(r/4),h=r%4,d=Math.floor(32+2*s+2*v-c-h)%7,y=Math.floor((a+11*c+22*d)/451),p=Math.floor((c+d-7*y+114)/31),T=(c+d-7*y+114)%31+1,S=Date.UTC(n,p-1,T+e),b=Date.UTC(n,0,1);return[Math.ceil((S-b)/(1e3*60*60*24))]}var pa=function(){function n(e){this.options=e}return n.prototype.rebuild=function(e,a){var t=this.options;if(e!==this.lastyear&&(this.yearinfo=ya(e,t)),j(t.bynweekday)&&(a!==this.lastmonth||e!==this.lastyear)){var r=this.yearinfo,l=r.yearlen,s=r.mrange,i=r.wdaymask;this.monthinfo=va(e,a,l,s,i,t)}F(t.byeaster)&&(this.eastermask=ma(e,t.byeaster))},Object.defineProperty(n.prototype,"lastyear",{get:function(){return this.monthinfo?this.monthinfo.lastyear:null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastmonth",{get:function(){return this.monthinfo?this.monthinfo.lastmonth:null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"yearlen",{get:function(){return this.yearinfo.yearlen},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"yearordinal",{get:function(){return this.yearin
Line truncated
|
||||
`),t=0;t<a.length;){var r=a[t]=a[t].replace(/\s+$/g,"");r?t>0&&r[0]===" "?(a[t-1]+=r.slice(1),a.splice(t,1)):t+=1:a.splice(t,1)}return a}function Ua(n){n.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function gt(n,e){return Ua(e),n.split(",").map(function(a){return at(a)})}function _t(n){var e=this;return function(a){if(a!==void 0&&(e["_".concat(n)]=a),e["_".concat(n)]!==void 0)return e["_".concat(n)];for(var t=0;t<e._rrule.length;t++){var r=e._rrule[t].origOptions[n];if(r)return r}}}var Ma=function(n){rt(e,n);function e(a){a===void 0&&(a=!1);var t=n.call(this,{},a)||this;return t.dtstart=_t.apply(t,["dtstart"]),t.tzid=_t.apply(t,["tzid"]),t._rrule=[],t._rdate=[],t._exrule=[],t._exdate=[],t}return e.prototype._iter=function(a){return Da(a,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(a){kt(a,this._rrule)},e.prototype.exrule=function(a){kt(a,this._exrule)},e.prototype.rdate=function(a){Dt(a,this._rdate)},e.prototype.exdate=function(a){Dt(a,this._exdate)},e.prototype.rrules=function(){return this._rrule.map(function(a){return wt(a.toString())})},e.prototype.exrules=function(){return this._exrule.map(function(a){return wt(a.toString())})},e.prototype.rdates=function(){return this._rdate.map(function(a){return new Date(a.getTime())})},e.prototype.exdates=function(){return this._exdate.map(function(a){return new Date(a.getTime())})},e.prototype.valueOf=function(){var a=[];return!this._rrule.length&&this._dtstart&&(a=a.concat($e({dtstart:this._dtstart}))),this._rrule.forEach(function(t){a=a.concat(t.toString().split(`
|
||||
`))}),this._exrule.forEach(function(t){a=a.concat(t.toString().split(`
|
||||
`).map(function(r){return r.replace(/^RRULE:/,"EXRULE:")}).filter(function(r){return!/^DTSTART/.test(r)}))}),this._rdate.length&&a.push(Et("RDATE",this._rdate,this.tzid())),this._exdate.length&&a.push(Et("EXDATE",this._exdate,this.tzid())),a},e.prototype.toString=function(){return this.valueOf().join(`
|
||||
`)},e.prototype.clone=function(){var a=new e(!!this._cache);return this._rrule.forEach(function(t){return a.rrule(t.clone())}),this._exrule.forEach(function(t){return a.exrule(t.clone())}),this._rdate.forEach(function(t){return a.rdate(new Date(t.getTime()))}),this._exdate.forEach(function(t){return a.exdate(new Date(t.getTime()))}),a},e}(g);function kt(n,e){if(!(n instanceof g))throw new TypeError(String(n)+" is not RRule instance");A(e.map(String),String(n))||e.push(n)}function Dt(n,e){if(!(n instanceof Date))throw new TypeError(String(n)+" is not Date instance");A(e.map(Number),Number(n))||(e.push(n),Ae(e))}function Et(n,e,a){var t=!a||a.toUpperCase()==="UTC",r=t?"".concat(n,":"):"".concat(n,";TZID=").concat(a,":"),l=e.map(function(s){return nt(s.valueOf(),t)}).join(",");return"".concat(r).concat(l)}const Ya={components:{calendarCreateSelect:Yt,DialogCreate:Mt,TimeSelect:kn,UploadingFile:Tn,ReminderEvent:On,PeriodEvents:Yn},props:{eventCalendar:{type:Object,default:()=>{}}},setup(n,{emit:e}){const a=O(null),t=H({get:()=>n.eventCalendar,set:w=>e("update:eventCalendar",w)}),r=[{type:"Не повторять",rule:{},id:1},{type:"Каждый день",rule:{freq:3},id:2},{type:"Каждую неделю",rule:{freq:2},id:3},{type:"Каждый месяц",rule:{freq:1},id:4},{type:"Каждый год",rule:{freq:0},id:5}],l=H({get(){let w="";if(t.value.event.period!=null){let D=JSON.parse(t.value.event.period);D!=null&&(s(D.origOptions),r.findIndex(U=>U.rule.freq==D.origOptions.freq),w=r[r.findIndex(U=>U.rule.freq==D.origOptions.freq)])}else w=r[0].type;return E(),w},set(w){s(w.rule)}}),s=w=>{let D;w.freq==3&&(D=new g({...w,dtstart:new Date(t.value.event.date_start),until:new Date(t.value.event.date_end)})),w.freq==2&&(D=new g({...w,dtstart:new Date(t.value.event.date_start),byweekday:Oe()})),w.freq==1&&(D=new g({...w,bymonthday:me(),dtstart:new Date(t.value.event.date_start)})),w.freq==0&&(D=new g({...w,bymonthday:Ve(),dtstart:new Date(t.value.event.date_start),bymonth:pe()})),Object.keys(w).length==0?t.value.event.period=null:t.value.event.period=JSON.stringify(D)},i=[g.SU,g.MO,g.TU,g.WE,g.TH,g.FR,g.SA],o=St().alert,c=w=>!!w||"Поле обязательно",v={name:[w=>c(w)]},h=O([]);ue.get("api/calendar_of_events/get_employees/").then(w=>{h.value=w.data.filter(D=>D.employees.length>0)});const d=Ie(),y=H({get(){let w=[],D=t.value.mycalendars.findIndex(U=>U.id==b.value[0].id);return h.value.forEach(U=>{let R={...U};R.employees=U.employees.filter(V=>((V.id==d.user.is_idEmployee||t.value.event.participant.some(oe=>V.id==oe))&&(V.selected=!0),t.value.mycalendars[D].participant.some(oe=>oe.id===V.id))),R.employees.length>0&&w.push(R)}),w}}),p=w=>{ue.delete(`api/calendar_of_events/my_events/?delid=${w}`).then(D=>{o.alert=!0,o.text=D.data.mess,o.ico="mdi-check",o.color="orange-accent-1",e("getCalendar")}),e("closeDialog")},T=O([]),S=w=>{T.value=w},b=H({get(){let w=[];if(t.value.event.calendar){let D=t.value.mycalendars.findIndex(U=>U.id==t.value.event.calendar);w.push({cl_name:t.value.mycalendars[D].cl_name,cl_color:t.value.mycalendars[D].cl_color,id:t.value.mycalendars[D].id})}else w.push({cl_name:t.value.mycalendars[0].cl_name,cl_color:t.value.mycalendars[0].cl_color,id:t.value.mycalendars[0].id});return t.value.event.calendar==null&&(t.value.event.calendar=t.value.mycalendars[0].id),w},set(w){t.value.event.calendar=w.value}}),C=O(""),I=O(!1),E=()=>{t.value.event.hasOwnProperty("id")?(C.value="Редактирование события",I.value=!1):(C.value="Новое событие",I.value=!0)},_=w=>{w.staff.forEach(D=>{if(D.selected==!0&&!t.value.event.participant.includes(D.id))t.value.event.participant.push(D.id);else{let U=t.value.event.participant.findIndex(R=>R==D.id);U!=-1&&t.value.event.participant.splice(U,1)}})},x=H({get(){return Tt(new Date(t.value.event.date_start))},set(w){w.split(".")}}),N=O(!1),re=w=>{if(w){let D=new FormData;D.append("event",JSON.stringify({...t.value.event})),t.value.event.files!==null&&T.value.forEach(U=>D.append("files",U)),ue.post("api/calendar_of_events/my_events/",D).then(U=>{o.alert=!0,o.text=U.data.mess,o.ico="mdi-check",o.color="green-darken-4",e("getCalendar"),e("closeDialog")})}},Oe=()=>{const w=new Date(t.value.event.date_start),D=new Date(t.value.event.date_end);let U=w.getDay(),R=D.getDay();const V=[];if(w.getDay()>D.getDay()){R=6;for(let J=U;J<=R;J++)V.push(J)}if(w.getDay()!=D.getDay()&&w.getDay()>D.getDay()){U=0;for(let J=U;J<=D.getDay();J++)V.push(J)}if(w.getDay()<D.getDay())for(let J=U;J<=D.getDay();J++)V.push(J);w.getDay()==D.getDay()&&V.push(w.getDay());let oe=[];return V.forEach(J=>{oe.push(i[J])}),oe},me=()=>{const w=new Date(t.value.event.date_start),D=new Date(t.value.event.date_end);let U=w.getDate(),R=D.getDate();const V=[];for(let oe=U;oe<=R;oe++)V.push(oe);return console.log(V.length,"дни в месяце"),V},Ve=()=>{const w=new Date(t.value.event.date_start),D=new Date(t.value.event.date_end);let U=Fe(w,D),R=[];return U.forEach(V=>R.push
Line truncated
|
||||
Reference in new issue
Block a user