PageSourceSearch

https://dcs.vn/7507.861b2795bfa7bc12.js

js dcs.vn collected 2026-09-24 21:35:32 UTC 11,765 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkmyapp=self.webpackChunkmyapp||[]).push([[7507],{77507:(K,y,c)=>{c.r(y),c.d(y,{CorePersonalScheduleComponent:()=>F});var o=c(23135),f=c(62252),w=c(48164),P=c(6882),m=c(52317),O=c(62794),D=c(15385),N=c(51996),v=c(41504);const I=[{value:null,label:"T\u1ea5t c\u1ea3"},{value:"C\xe1 nh\xe2n",label:"C\xe1 nh\xe2n"},{value:"\u0110\u01a1n v\u1ecb",label:"\u0110\u01a1n v\u1ecb"},{value:"L\xe3nh \u0111\u1ea1o",label:"L\xe3nh \u0111\u1ea1o"}],R=[{value:"none",label:"Kh\xf4ng l\u1eb7p l\u1ea1i"},{value:"daily",label:"H\xe0ng ng\xe0y"},{value:"workdays",label:"C\xe1c ng\xe0y trong tu\u1ea7n (T2 - T6)"},{value:"weekly_wed",label:"H\xe0ng tu\u1ea7n v\xe0o th\u1ee9 \u0111\xe3 ch\u1ecdn"},{value:"yearly_mar_18",label:"H\xe0ng n\u0103m v\xe0o ng\xe0y \u0111\xe3 ch\u1ecdn"},{value:"custom",label:"T\xf9y ch\u1ec9nh"}];function E(t){switch((t??"").toString().trim().toUpperCase()){case"DEPARTMENT":return"\u0110\u01a1n v\u1ecb";case"LEADER":return"L\xe3nh \u0111\u1ea1o";default:return"C\xe1 nh\xe2n"}}function C(t){const a=new Date(t.startTime);return{id:String(t.id),title:t.title,startAt:t.startTime,endAt:t.endTime,timeDisplay:k(a),location:t.location,createdBy:t.createdBy?(0,D.Bae)(t.createdBy):"--",createdByFullName:t.createdByFullName||t.createdBy?(0,D.Bae)(t.createdByFullName||t.createdBy):"--",createdAt:t.createdDate||(new Date).toISOString(),source:E(t.eventType),recurrenceType:t.recurrenceType||"NONE",recurrenceEndDate:t.recurrenceEndDate,note:t.description||void 0,origin:"ccud"}}function b(t,a){const r=t??"none";if("none"===r)return{recurrenceType:"NONE"};if("daily"===r)return{recurrenceType:"DAILY"};if("workdays"===r)return{recurrenceType:"WORKDAYS"};if("weekly_wed"===r)return{recurrenceType:"WEEKLY"};if("yearly_mar_18"===r)return{recurrenceType:"YEARLY"};const e="onDate"===a?.endMode?a.endOnDate:"untilDate"===a?.endMode?a.untilDate:null;return{recurrenceType:"month"===a?.unit?"YEARLY":"WEEKLY",recurrenceEndDate:e?e.toISOString():void 0}}function k(t){return`${function A(t){switch(t){case 1:return"Th\u1ee9 Hai";case 2:return"Th\u1ee9 Ba";case 3:return"Th\u1ee9 T\u01b0";case 4:return"Th\u1ee9 N\u0103m";case 5:return"Th\u1ee9 S\xe1u";case 6:return"Th\u1ee9 B\u1ea3y";default:return"Ch\u1ee7 Nh\u1eadt"}}(t.getDay())}, ${String(t.getDate()).padStart(2,"0")}/${String(t.getMonth()+1).padStart(2,"0")}/${t.getFullYear()}  ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}let F=(()=>{class t{constructor(){this.breadcrumbService=(0,o.WQX)(D.BZs),this.toastService=(0,o.WQX)(O.Mo),this.calendarEventsService=(0,o.WQX)(N.iI),this.checkPermissionService=(0,o.WQX)(D.X4S),this.showUpdate=!1,this.showDelete=!1,this.destroy$=new f.B,this.searchSubject=new f.B,this.loading=(0,o.vPA)(!1),this.events=(0,o.vPA)([]),this.sourceOptions=I,this.repeatOptions=R,this.pagingParams={searchKey:"",pageIndex:1,pageSize:10,total:0,searchBoxConfig:{placeholder:"T\xecm ki\u1ebfm l\u1ecbch h\u1ecdp..."},onChangePagingParams:(r,e)=>{switch(e){case"pageIndex":this.pagingParams.pageIndex=r;break;case"pageSize":this.pagingParams.pageSize=r;break;case"search":this.pagingParams.searchKey=r||"",this.pagingParams.pageIndex=1;break;case"pageIndexAndSize":this.pagingParams.pageSize=r.pageSize,this.pagingParams.pageIndex=r.pageIndex}this.loadData()},afterReloadTable:()=>{}}}ngOnInit(){this.checkActionPermission(),this.breadcrumbService.setBreadcrumbs([{label:"Trang ch\u1ee7",url:"/dashboard"},{label:"L\u1ecbch",disabled:!0},{label:"L\u1ecbch c\xe1 nh\xe2n",url:"/personal-schedule"}]),this.searchSubject.pipe((0,w.B)(2e3),(0,P.F)(),(0,m.Q)(this.destroy$)).subscribe(r=>{const e=r.trim();1!==e.length&&(this.pagingParams.searchKey=e,this.pagingParams.pageIndex=1,this.loadData())}),this.loadData()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}checkActionPermission(){this.checkPermissionService.checkPermissionForActionByMethod(["PATCH","DELETE"],["/api/user/calendar-events/{id}","/api/user/calendar-events/{id}"]).subscribe({next:n=>{const s=n.data??n;this.showUpdate=!0===s[0],this.showDelete=!0===s[1]},error:()=>{this.showUpdate=!1,this.showDelete=!1}})}loadData(){const r=this.calendarRef;this.loading.set(!0);const e=r?.getCalendarState(),n=!e||"list"===e.displayMode,s=e?.filterMonth??null,i=e?.calendarGranularity??"month",l=e?.calendarDisplayYear??(new Date).getFullYear(),d=e?.selectedDate??null,g=e?.calendarDate??new Date,u=e?.listFilterDate??null,{startDate:h,endDate:S}=function B(t){if(t.isDayGranularity){const n=t.selectedDate??t.calendarDate;return{startDate:new Date(n.getFullYear(),n.getMonth(),n.getDate(),0,0,0,0).toISOString(),endDate:new Date(n.getFullYear(),n.getMonth(),n.getDate(),23,59,59,999).toISOString()}}if(t.isWeekGranularity){const n=t.selectedDate??t.calendarDate,s=(n.getDay()+6)%7,i=new Date(n.getFullYear(),n.getMonth(),n.getDate()-s,0,0,0,0),l=new Date(i.getFullYear(),i.getMonth(),i.getDate()+6,23,59,59,999);return{startDate:i.toISOString(),endDate:l.toISOString()}}if(t.isYearGranularity){const n=t.calendarDisplayYear;return{startDate:new Date(n,0,1,0,0,0,0).toISOString(),endDate:new Date(n,11,31,23,59,59,999).toISOString()}}const a=t.selectedDate??t.calendarDate,r=a.getFullYear();if(t.month){const n=t.month-1;return{startDate:new Date(r,n,1,0,0,0,0).toISOString(),endDate:new Date(r,n+1,0,23,59,59,999).toISOString()}}const e=a.getMonth();return{startDate:new Date(r,e,1,0,0,0,0).toISOString(),endDate:new Date(r,e+1,0,23,59,59,999).toISOString()}}({month:s,isYearGranularity:"year"===i,isWeekGranularity:"week"===i,isDayGranularity:"day"===i,calendarDisplayYear:l,selectedDate:d,calendarDate:g});this.calendarEventsService.listUserCalendarEvents({startDate:h,endDate:S,type:"PERSONAL"}).pipe((0,m.Q)(this.destroy$)).subscribe({next:T=>{let p=function _(t,a){const r=a.keyword.trim().toLowerCase();return t.map(e=>({event:e,source:E(e.eventType),createdByFullName:e.createdByFullName||e.createdBy||""})).filter(({event:e,source:n,createdByFullName:s})=>!(a.month&&new Date(e.startTime).getMonth()+1!==a.month||a.sourceFilter&&n!==a.sourceFilter)&&(!r||`${e.title} ${e.location} ${s} ${n}`.toLowerCase().includes(r))).sort((e,n)=>new Date(n.event.startTime).getTime()-new Date(e.event.startTime).getTime()).map(({event:e})=>C(e))}(T,{month:s,sourceFilter:e?.filterSource??null,keyword:this.pagingParams.searchKey||""});if(n&&u){const x=this.formatDayKey(u);p=p.filter(z=>this.formatDayKey(new Date(z.startAt))===x)}const{total:Y,items:H}=function U(t,a){const r=t.length,e=Math.max(1,a.pageIndex),n=Math.max(1,a.pageSize);return{total:r,items:t.slice((e-1)*n,e*n)}}(p,{pageIndex:this.pagingParams.pageIndex,pageSize:this.pagingParams.pageSize});this.pagingParams.total=Y,this.events.set(p),this.calendarRef?.updateEvents(H),this.loading.set(!1)},error:()=>{this.events.set([]),this.pagingParams.total=0,this.loading.set(!1),this.toastService.error("","T\u1ea3i d\u1eef li\u1ec7u th\u1ea5t b\u1ea1i")}})}onCreate(r){if(!r.title)return void this.toastService.error("","Vui l\xf2ng nh\u1eadp t\xean cu\u1ed9c h\u1ecdp");if(!r.date||!r.startTime||!r.endTime)return void this.toastService.error("","Vui l\xf2ng ch\u1ecdn ng\xe0y, th\u1eddi gian b\u1eaft \u0111\u1ea7u v\xe0 th\u1eddi gian k\u1ebft th\xfac");const e=new Date(r.date),[n,s]=r.startTime.split(":"),i=Number(n),l=Number(s);if(Number.isNaN(i)||Number.isNaN(l))return void this.toastService.error("","Th\u1eddi gian b\u1eaft \u0111\u1ea7u kh\xf4ng h\u1ee3p l\u1ec7");e.setHours(i,l,0,0);const[d,g]=r.endTime.split(":"),u=Number(d),h=Number(g);if(Number.isNaN(u)||Number.isNaN(h))return void this.toastService.error("","Th\u1eddi gian k\u1ebft th\xfac kh\xf4ng h\u1ee3p l\u1ec7");const S=new Date(r.date);if(S.setHours(u,h,0,0),S<=e)return void this.toastService.error("","Th\u1eddi gian k\u1ebft th\xfac ph\u1ea3i sau th\u1eddi gian b\u1eaft \u0111\u1ea7u");const T=function M(t){const a=b(t.repeat,t.customRepeat);return{appCode:"CCUD",title:t.title,startTime:t.start.toISOString(),endTime:t.end.toISOString(),eventType:"PERSONAL",recurrenceType:a.recurrenceType,recurrenceEndDate:a.recurrenceEndDate,location:t.location||"--",description:t.note||""}}({title:r.title,start:e,end:S,repeat:r.repeat,location:r.location,note:r.note});this.calendarEventsService.createUserCalendarEvent(T).pipe((0,m.Q)(this.destroy$)).subscribe({next:()=>{this.toastService.success("","Th\xeam l\u1ecbch th\xe0nh c\xf4ng"),this.pagingParams.pageIndex=1,this.loadData()},error:()=>{this.toastService.error("","Th\xeam l\u1ecbch th\u1ea5t b\u1ea1i")}})}onEdit({id:r,payload:e}){if(!this.showUpdate)return void this.toastService.error("","B\u1ea1n kh\xf4ng c\xf3 quy\u1ec1n ch\u1ec9nh s\u1eeda l\u1ecbch");if(!e.date||!e.startTime||!e.endTime)return void this.toastService.error("","Vui l\xf2ng ch\u1ecdn ng\xe0y, th\u1eddi gian b\u1eaft \u0111\u1ea7u v\xe0 th\u1eddi gian k\u1ebft th\xfac");const n=new Date(e.date);n.setHours(e.startTime.getHours(),e.startTime.getMinutes(),0,0);const s=new Date(e.date);if(s.setHours(e.endTime.getHours(),e.endTime.getMinutes(),0,0),s<=n)return void this.toastService.error("","Th\u1eddi gian k\u1ebft th\xfac ph\u1ea3i sau th\u1eddi gian b\u1eaft \u0111\u1ea7u");const i=function L(t){const a=b(t.repeat,t.customRepeat);return{title:t.title,startTime:t.start.toISOString(),endTime:t.end.toISOString(),recurrenceType:a.recurrenceType,recurrenceEndDate:a.recurrenceEndDate,location:t.location||"--",description:t.note||""}}({title:e.title.trim(),start:n,end:s,repeat:e.repeat,location:e.location.trim(),note:e.note});this.calendarEventsService.updateUserCalendarEvent(r,i).pipe((0,m.Q)(this.destroy$)).subscribe({next:l=>{const d=C(l);this.toastService.success("","L\u01b0u ch\u1ec9nh s\u1eeda th\xe0nh c\xf4ng");const g=this.events(),u=g.findIndex(h=>h.id===d.id);if(u>=0){const h=[...g];h[u]=d,this.events.set(h)}this.loadData()},error:()=>{this.toastService.error("","C\u1eadp nh\u1eadt l\u1ecbch th\u1ea5t b\u1ea1i")}})}onDelete(r){this.showDelete?this.calendarEventsService.deleteUserCalendarEvent(r).pipe((0,m.Q)(this.destroy$)).subscribe({next:()=>{this.toastService.success("","X\xf3a th\xe0nh c\xf4ng"),this.loadData()},error:e=>{const n=e?.status,s=e?.error?.errorCode||e?.error?.code;404===n||"ENTITY_NOT_FOUND"===s||"ENTITY_NOT_EXIST"===s?(this.toastService.error("","B\u1ea3n ghi \u0111\xe3 b\u1ecb x\xf3a"),this.loadData()):this.toastService.error("","X\xf3a l\u1ecbch th\u1ea5t b\u1ea1i")}}):this.toastService.error("","B\u1ea1n kh\xf4ng c\xf3 quy\u1ec1n x\xf3a l\u1ecbch")}formatDayKey(r){return`${r.getFullYear()}
1-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")}`}static{this.\u0275fac=function(e){return new(e||t)}}static{this.\u0275cmp=o.VBU({type:t,selectors:[["lib-core-personal-schedule"]],viewQuery:function(e,n){if(1&e&&o.GBs(v.S,5),2&e){let s;o.mGM(s=o.lsd())&&(n.calendarRef=s.first)}},decls:1,vars:8,consts:[["entityName","L\u1ecbch c\xe1 nh\xe2n","timeInputMode","end-time",3,"reload","searchChange","createSubmit","editSubmit","deleteConfirm","events","loading","pagingParams","readOnly","hideCreate","hideUpdate","hideDelete","repeatOptions"]],template:function(e,n){1&e&&(o.j41(0,"custom-pro-calendar",0),o.bIt("reload",function(){return n.loadData()})("searchChange",function(){return n.loadData()})("createSubmit",function(i){return n.onCreate(i)})("editSubmit",function(i){return n.onEdit(i)})("deleteConfirm",function(i){return n.onDelete(i)}),o.k0s()),2&e&&o.Y8G("events",n.events())("loading",n.loading())("pagingParams",n.pagingParams)("readOnly",!1)("hideCreate",!0)("hideUpdate",!n.showUpdate)("hideDelete",!n.showDelete)("repeatOptions",n.repeatOptions)},dependencies:[v.S],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;flex:1 1 auto;min-height:0;height:100%}"]})}}return t})()}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.