diff --git a/src/db.sqlite3 b/src/db.sqlite3 index cfe7579c4..1a8ef2ad5 100644 Binary files a/src/db.sqlite3 and b/src/db.sqlite3 differ diff --git a/src/front/src/components/digital-letna.vue b/src/front/src/components/digital-letna.vue index 928e71fdb..af2eaf2e1 100644 --- a/src/front/src/components/digital-letna.vue +++ b/src/front/src/components/digital-letna.vue @@ -44,7 +44,7 @@ - {{t_dailyRound.position}} + - + @@ -191,12 +191,14 @@ export default { const t_daily = ref('') const idpos = ref('') const dialogDetailRound = ref(false) - const t_dailyRound = ref('') - const dailyfiles = ref('') + const t_dailyRound = ref({}) + const dailyfiles = ref([]) const info = ref({}) const searchname = ref('') const menuGetUserDialog = ref(false) const iduser = ref('') + const result = ref({}) + const getcard = async (idus) => { menuGetUserDialog.value = true @@ -207,7 +209,11 @@ export default { idpos.value=pos dialogDetailRound.value=!dialogDetailRound.value axiosApiInstance.get(`api/general_vacation/dailyload/?id=${pos}`).then(data => { + t_dailyRound.value = data.data + + result.value=JSON.parse(JSON.stringify(data.data)) + }) } @@ -232,27 +238,38 @@ export default { axiosApiInstance.get('api/general_vacation/dailyload/') .then(data => { - t_daily.value = data.data.daily + t_daily.value = data.data }) } - watch(()=> searchname.value,(newValue,oldValue)=>{ - - if(newValue){ + const filterItems = (query) => { + + result.value={} + Object.keys(t_dailyRound.value).map(el1 => { + let myarr = t_dailyRound.value[el1].filter((el) =>el.fio.toLowerCase().includes(query.toLowerCase())) + + if(myarr.length>0) + { + result.value[el1] = myarr + } + + - axiosApiInstance.get(`api/general_vacation/dailyload/?id=${idpos.value}&searchname=${newValue}`) - .then(data => { - - t_dailyRound.value = data.data - }) + } + ) + +} + + watch(()=> searchname.value,(newValue,oldValue)=>{ + + if(newValue){ + filterItems(newValue) + } else { - axiosApiInstance.get(`api/general_vacation/dailyload/?id=${idpos.value}`) - .then(data => { - - t_dailyRound.value = data.data - }) + result.value = JSON.parse(JSON.stringify(t_dailyRound.value)) + } }, {deep:true}) @@ -275,7 +292,8 @@ export default { spravURL, menuGetUserDialog, iduser, - getcard + getcard, + result } } diff --git a/src/general_vacation/views.py b/src/general_vacation/views.py index c20ae7f85..d305903a6 100644 --- a/src/general_vacation/views.py +++ b/src/general_vacation/views.py @@ -292,11 +292,12 @@ class DailyloadAPIView(APIView): df_user = pd.DataFrame.from_records(user) df_daily = pd.DataFrame.from_records(dailyr) df_daily.columns = ["login", "pos", "idpos"] + df = pd.merge(df_user, df_daily, left_on= 'login', right_on="login") result={} - pos=dailyr[0][1] + if request.GET.__contains__('id'): df=df.loc[df['idpos']==int(request.GET.get("id"))] @@ -308,20 +309,20 @@ class DailyloadAPIView(APIView): for index, row in df.iterrows (): if row['department'] in result.keys(): - result[row['department']].append({'login':row['login'],'fio':row['fio'], 'post':row['post']}) + result[row['department']].append({'login':row['login'],'fio':row['fio'], 'post':row['post'], 'pos':row['pos']}) else: - result[row['department']]=[{'login':row['login'],'fio':row['fio'], 'post':row['post']}] + result[row['department']]=[{'login':row['login'],'fio':row['fio'], 'post':row['post'], 'pos':row['pos']}] daily = result else: - pos='' + daily = DailyRoundUp.objects.values('position__name', 'position').filter(todaysDate=date.today()).annotate(Count('user')) except Exception as e: - pos='' + daily="" - return Response({'daily':daily, 'position':pos}) + return Response(daily) class SearchUserAPIView(APIView): def post(self, request): diff --git a/src/media/newsimage/2023/11/07/i0000209156-detail.jpeg b/src/media/newsimage/2023/11/07/i0000209156-detail.jpeg new file mode 100644 index 000000000..2350c66ad Binary files /dev/null and b/src/media/newsimage/2023/11/07/i0000209156-detail.jpeg differ