File manager - Edit - /home/autoph/public_html/projects/ahg-hr/assets/form.ccb2b45c.js
Back
import"./index.8a5f8558.js";import{I as ce}from"./index.1b36081b.js";import{_ as ue,r as P,o as d,c as T,w as x,d as s,a4 as re,b as c,e as g,t as n,h as R,j as f,q as B,k as M,F,m as I,f as v,n as pe}from"./index.28ae41da.js";import{C as fe}from"./CloseButton.dacc4a7b.js";import{E as ye}from"./EditButton.4c7b9ec2.js";/* empty css */import{P as _e}from"./ProcessButton.65e0d267.js";import{S as ge}from"./SettingsButton.d4c7372d.js";import{S as be}from"./SubmitButton.be4371c4.js";import{U as ve}from"./UpdateButton.a9e9b37b.js";import{D as xe,L as ke,a as De}from"./index.ca4614c1.js";import{E as Pe}from"./jspdf.es.min.cdd8e899.js";/* empty css */import{H as Ce}from"./HelperService.86a88cb6.js";import{A as O}from"./AttendancePostingService.7d1ca5a4.js";import{C as we}from"./CompanyService.625a2c1a.js";import{D as Te}from"./DealershipService.b9363e21.js";import{E as ne}from"./EmployeeService.67ccb7ea.js";import{P as de}from"./PayrollDateService.f23eaa15.js";import{F as Ee}from"./index.975c3902.js";import{F as Re}from"./index.164dfd27.js";/* empty css */import{T as Se}from"./index.33bd7660.js";import"./vue-cleave.min.10e51f16.js";import{c as Oe,a as me,V as Fe}from"./array.19531b35.js";import{L as Be}from"./Loading.fa197db1.js";import"./vue-quill.snow.464b7516.js";/* empty css */import{T as Ie}from"./index.b0bec482.js";import{P as He}from"./index.1055a38a.js";import{T as Le}from"./index.c55b32ee.js";import"./jspdf.plugin.autotable.5d1d93cc.js";import"./logo-black.7c15feb3.js";import"./logo-white.b04c5a89.js";import"./transition.4769b1c9.js";import"./es.string.replace.a39053f7.js";import"./index.17d4213d.js";import"./index.85943672.js";import"./Loading.vue_vue_type_style_index_0_scoped_cbded5a2_lang.e35c8e45.js";import"./index.43beecaf.js";import"./jspdf.es.min.cfd18141.js";const We={name:"ActionDropdown",components:{Dropdown:xe,Icon:ce},props:{label:{type:String,default:null},labelClass:{type:String,default:null}}},Me={key:0,class:"text-xl"},Ne={class:"border border-slate-300 rounded pt-1"};function je(e,t,i,r,o,l){const m=P("Icon"),u=P("Dropdown");return d(),T(u,{classMenuItems:"text-center w-[140px]"},{menus:x(()=>[s("div",Ne,[re(e.$slots,"default")])]),default:x(()=>[!i.label&&!e.$slots.label?(d(),c("span",Me,[g(m,{icon:"heroicons-outline:dots-horizontal"})])):i.label?(d(),c("span",{key:1,class:R(["text-lg tracking-wide",i.labelClass])},n(i.label),3)):e.$slots.label?re(e.$slots,"label",{key:2}):f("",!0)]),_:3})}const Ve=ue(We,[["render",je]]),Ue="/assets/attendance.9fe3ea9d.mp4";const qe={components:{Layout:ke,Loading:Be,EditButton:ye,UpdateButton:ve,SubmitButton:be,SettingsButton:ge,CloseButton:fe,ProcessButton:_e,FormGroup:Ee,Multiselect:De,Icon:ce,Table:Le,ActionDropdown:Ve,Panel:He,TextInput:Ie,FormModal:Re,TextArea:Se},setup(){},data(){return{title:"Attendance Postings",breadcrumbs:[{text:"Home",href:"/"},{text:"Payroll",href:"/payroll"},{text:"Attendance Postings",href:"/attendance-posting"},{text:"Attendance Postings Form",active:!0}],items:[],totalItems:0,companyOptions:[],payrollDateOptions:[],dealers:[],departments:[],employees:null,period:null,form:{payroll_date:null,company_id:null,dealership_id:null},selectedRow:null,selectedEmployee:null,selectedEmployeeName:null,selectedEmployeeDetail:null,processingEmployee:null,columns:[{label:"Reference No",field:"reference_no"},{label:"Company",field:"company"},{label:"Dealership",field:"dealership"},{label:"Payroll Date",field:"payroll_date"},{label:"Cut-off",field:"cut_off"},{label:"Last Updated",field:"updated_at",format:function(e){return B(e).format("MMM DD, Y")}},{label:"Posted",field:"posted_at",format:function(e){return e?B(e).format("MMM DD, Y"):null}}],dealerColumns:[{label:"Dealer",field:"dealer_name",tdClass:"w-[60%]"},{label:"Created",field:"created",tdClass:"item-center text-center"},{label:"Posted",field:"posted",tdClass:"items-center text-center"}],employeeColumns:[{label:"Name",field:"name"}],attendanceColumns:[{label:"Employee",field:"employee",tdClass:""},{label:"Department",field:"department"},{label:"Work Hours",field:"work_hours",tdClass:"text-center"},{label:"Leave Hours",field:"leave_hours",tdClass:"text-center",format:function(e){return e>0?e:null}},{label:"Days Absent",field:"days_absent",tdClass:"text-center",format:function(e){return e>0?e:null}},{label:"Mins. Tardy",field:"minutes_late",tdClass:"text-center",format:function(e){return e>0?e:null}},{label:"Mins. Undertime",field:"minutes_undertime",tdClass:"text-center",format:function(e){return e>0?e:null}},{label:"Overtime",field:"overtime"}],serverOptions:{sortBy:null,sortType:"asc"},selectedDealer:null,selectedDepartment:null,timelogForm:{},state:{isLoading:!1,isEdit:!1,isDeleting:!1,showFormPanel:!0,showEmployees:!1,fetchingEmployees:!1,processStatus:null,fetchingPayrollDates:!1,fetchingCompanies:!1,fetchingDealers:!1,cancelProcessing:!1,showPostingRecords:!0,showProcessedRecords:!1,showProcessingSection:!1,showProcessButton:!1,showPostButton:!1,showUnpostButton:!1,showSummary:!1,processingError:!1,showModal:!1,showTimeLogEdit:!1},noDataMessage:null,queryEmployee:null,attendanceQuery:null,totalEmployees:0,processedEmployees:0,attendance:[],attendanceForm:[],completedDepartments:[],processedRecords:null,selectedTimelog:null,startTime:null,elapsedTime:null,errors:{},timelogData:{}}},watch:{},computed:{Helper(){return Ce},dealerList(){var i;let e=[];if(!this.form.company_id)return e;if(!this.form.payroll_date)return this.noDataMessage="Please select payroll date",e;const t=(i=this.dealers)==null?void 0:i.filter(r=>r.company_id==this.form.company_id&&r.departments.length>0);return t&&t.length>0&&t.forEach(r=>{var p;const o=(p=this.completedDepartments)==null?void 0:p.filter(_=>_.dealership_id==r.id);let l=0,m=0;const u=o?o.find(_=>_.posted==!0):!1;r.departments.forEach(_=>{l++,o.find(k=>k.department_id==_.id)&&m++}),console.log("this.processedRecords"),console.log(this.processedRecords),console.log(`completed: ${m}`),console.log(`dept: ${l}`);const h=m>=l;e.push({dealership_id:r.id,dealer_name:r.name,created:h,posted:!!u,released:!1,departments:r.departments})}),e},filteredEmployees(){let e=this.employees;return this.selectedDepartment&&(e=e.filter(t=>this.selectedDepartment==t.department_id)),this.attendance.length>0&&(e=e.map(t=>{var o;const i=this.attendance.find(l=>l.employee_id==t.employee_id);let r=this.noTITO.some(l=>l.employee_id===t.employee_id)||this.noSchedule.some(l=>l.employee_id===t.employee_id)||this.incompleteTITO.some(l=>l.employee_id===t.employee_id);return((o=t==null?void 0:t.salary_and_wages)==null?void 0:o.always_present)==1&&(r=!1),{...t,hasAttendance:i,hasWarning:r}})),e},employeeList(){let e=this.filteredEmployees;return this.queryEmployee&&(e=e.filter(t=>t.firstname.toLowerCase().includes(this.queryEmployee.toLowerCase())||t.lastname.toLowerCase().includes(this.queryEmployee.toLowerCase())||t.employee_id.toString().toLowerCase().includes(this.queryEmployee.toLowerCase()))),e},companyAccess(){return this.$store.userSettings.getCompanyAccess?this.$store.userSettings.getCompanyAccess.map(e=>e.id):[]},dealershipAccess(){return this.$store.userSettings.getDealershipAccess?this.$store.userSettings.getDealershipAccess.map(e=>e.id):[]},departmentOptions(){let e=[];return this.departments.length>0&&this.departments.forEach(t=>{const i=!!(this.completedDepartments&&this.completedDepartments.find(r=>r.department_id==t.id));e.push({value:t.id,label:t.name,completed:i})}),e},attendanceDetails(){let e=[];return this.attendance.length>0&&(e=this.attendance.map(t=>{const i=t.data.overtime?t.data.overtime.reduce((l,m)=>{const{payment_setting_id:u=0,payment_setting_name:h="",no_of_hours:p=0,percentage:_=0,meal:b=0,transportation:k=0,transportation_amount:E=0}=m,C=l.find(w=>w.payment_setting_id===u);return C?(C.no_of_hours+=parseFloat(p),C.hours_per_day.push({hours:parseFloat(p),meal:b,transportation:k,transportation_amount:parseFloat(E)})):l.push({payment_setting_id:u>0?u:null,payment_setting_name:h!=""?h:null,no_of_hours:parseFloat(p),hours_per_day:[{hours:parseFloat(p),meal:b,transportation:k,transportation_amount:parseFloat(E)}],percentage:_}),l},[]):[],r=t.data.holiday?t.data.holiday.reduce((l,m)=>{const{payment_setting_id:u=0,payment_setting_name:h="",holiday_type:p=0,no_of_hours:_=0,percentage:b=0,meal:k=0,transportation:E=0,transportation_amount:C=0}=m,w=l.find(D=>D.payment_setting_id===u);return w?(w.no_of_hours+=parseFloat(_),w.hours_per_day.push({hours:parseFloat(_),meal:k,transportation:E,transportation_amount:parseFloat(C)})):l.push({payment_setting_id:u>0?u:null,payment_setting_name:h!=""?h:null,holiday_type:p>0?p:null,percentage:b,no_of_hours:parseFloat(_),hours_per_day:[{hours:parseFloat(_),meal:k,transportation:E,transportation_amount:parseFloat(C)}]}),l},[]):[],o=t.data.night_differential?t.data.night_differential.reduce((l,m)=>{const{payment_setting_id:u=0,payment_setting_name:h="",no_of_hours:p=0,percentage:_=0}=m,b=l.find(k=>k.payment_setting_id===u);return b?b.no_of_hours+=parseFloat(p):l.push({payment_setting_id:u>0?u:null,payment_setting_name:h!=""?h:null,percentage:_,no_of_hours:parseFloat(p)}),l},[]):[];return{employee_id:t.employee_id,company_id:this.form.company_id,dealership_id:this.form.dealership_id,department_id:t.department_id,work_days:t.data.workDays??0,actual_work_days:t.data.actualWorkDays??0,work_hours:t.data.dailyWorkHours?t.data.dailyWorkHours.reduce((l,m)=>l+parseFloat(m.work_hours),0):0,leave_hours:t.data.leave?t.data.leave.reduce((l,m)=>l+(m.without_pay==0?parseFloat(m.no_of_hours):0),0):0,days_absent:t.data.absent?t.data.absent.reduce((l,m)=>l+parseFloat(m.no_of_days),0):0,hours_absent:t.data.absent?t.data.absent.reduce((l,m)=>l+parseFloat(m.no_of_hours),0):0,minutes_late:t.data.tardiness?t.data.tardiness.reduce((l,m)=>l+parseFloat(m.no_of_minutes),0):0,minutes_undertime:t.data.undertime?t.data.undertime.reduce((l,m)=>l+parseFloat(m.no_of_minutes),0):0,overtime_totals:i.length>0?JSON.stringify(i):null,holiday_totals:r.length>0?JSON.stringify(r):null,night_diff_totals:o.length>0?JSON.stringify(o):null}})),e},selectedAttendance(){let e=null;if(console.log("attendance"),console.log(this.attendance),this.selectedEmployee){let t=this.attendance.find(r=>r.employee_id==this.selectedEmployee);t=t.data;let i=[];console.log("this is period",this.period.date_range),this.period.date_range.forEach(r=>{var m,u,h,p,_,b,k,E,C,w,D,H,L;const o=(m=t==null?void 0:t.timelog)==null?void 0:m.find(y=>y.date==r&&y.in_out=="I"),l=(u=t==null?void 0:t.timelog)==null?void 0:u.find(y=>y.date==r&&y.in_out=="O");i.push({date:r,timelog:{timeIn:o,timeOut:l,in:o?o.time:null,out:l?l.time:null},schedule:(h=t==null?void 0:t.schedule)==null?void 0:h.find(y=>y.date==r),leave:(p=t==null?void 0:t.leave)==null?void 0:p.find(y=>y.date==r),ob:(_=t==null?void 0:t.ob)==null?void 0:_.find(y=>y.date==r),offset:(b=t==null?void 0:t.offset)==null?void 0:b.find(y=>y.date==r),tardiness:(k=t==null?void 0:t.tardiness)==null?void 0:k.find(y=>y.date==r),undertime:(E=t==null?void 0:t.undertime)==null?void 0:E.find(y=>y.date==r),overtime:(C=t==null?void 0:t.overtime)==null?void 0:C.find(y=>y.date==r),night_differential:(w=t==null?void 0:t.night_differential)==null?void 0:w.find(y=>y.date==r),absent:(D=t==null?void 0:t.absent)==null?void 0:D.find(y=>y.date==r),holiday:(H=t==null?void 0:t.holiday)==null?void 0:H.find(y=>y.date==r),workHours:(L=t==null?void 0:t.dailyWorkHours)==null?void 0:L.find(y=>y.date==r),hasWarning:!!this.incompleteTITO.find(y=>y.employee_id==this.selectedEmployee&&y.date==r)})}),e=i}return e},overallProgress(){return Math.round(this.processedEmployees/this.totalEmployees*100)},filteredAttendance(){let e=this.processedRecords.details?this.processedRecords.details:[];if(this.attendanceQuery){const t=this.attendanceQuery.toLowerCase();e=e==null?void 0:e.filter(i=>i.employee.firstname.toLowerCase().includes(t)||i.employee.lastname.toLowerCase().includes(t)||i.employee_id.toLowerCase().includes(t)||i.department&&i.department.name.toLowerCase().includes(t))}return e},noTITO(){let e=[];return this.employees.length>0&&this.employees.forEach(t=>{var r,o,l;const i=(r=this.attendance)==null?void 0:r.find(m=>m.employee_id==t.employee_id);i&&i.data.timelog.length==0&&i.data.ob.length==0&&i.data.leave.length==0&&e.push({employee_id:t.employee_id,name:t.name,department:((l=(o=this.departments)==null?void 0:o.find(m=>m.id==t.department_id))==null?void 0:l.name)||t.department_id})}),e},noSchedule(){let e=[];return this.employees.length>0&&this.employees.forEach(t=>{var r,o,l;const i=(r=this.attendance)==null?void 0:r.find(m=>m.employee_id==t.employee_id);i&&i.data.schedule.length==0&&e.push({employee_id:t.employee_id,name:t.name,department:((l=(o=this.departments)==null?void 0:o.find(m=>m.id==t.department_id))==null?void 0:l.name)||t.department_id})}),e},incompleteTITO(){let e=[];return this.employees.length>0&&this.employees.forEach(t=>{var r;const i=(r=this.attendance)==null?void 0:r.find(o=>o.employee_id==t.employee_id);i&&(i.data.timelog.length>0||i.data.ob.length>0)&&this.period.date_range.forEach(o=>{var h,p,_,b,k,E,C,w;const l=(p=(h=i.data)==null?void 0:h.timelog)==null?void 0:p.find(D=>D.date==o&&D.in_out=="I"),m=(b=(_=i.data)==null?void 0:_.timelog)==null?void 0:b.find(D=>D.date==o&&D.in_out=="O");((E=(k=i.data)==null?void 0:k.ob)==null?void 0:E.find(D=>D.date==o))||(l&&!m||!l&&m)&&e.push({employee_id:t.employee_id,name:t.name,department:((w=(C=this.departments)==null?void 0:C.find(D=>D.id==t.department_id))==null?void 0:w.name)||t.department_id,date:o,time_in:l,time_out:m})})}),e}},methods:{customLabel(e){return` <div class="flex items-center space-x-2 p-2 hover:bg-blue-500"> <strong class="text-blue-600">${e.label}</strong> <span class="text-gray-500">Value: ${e.value}</span> </div> `},async fetchPayrollDates(){this.state.fetchingPayrollDates=!0,await de.fetchRecords().then(e=>{e.status==200&&(this.payrollDateOptions=e.data.data.map(t=>({value:t.payroll_date,label:t.date_from?t.payroll_date+" ("+this.$formatDate(t.date_from)+" to "+this.$formatDate(t.date_to)+") ":t.payroll_date})))}).catch(e=>{console.error(e)}).finally(()=>this.state.fetchingPayrollDates=!1)},async fetchCompanies(){this.state.fetchingCompanies=!0,console.log("this.$store.userSettings.getCompanyAccess"),console.log(this.companyAccess),await we.fetchRecords().then(e=>{e.status==200&&(this.companyOptions=e.data.data.filter(t=>this.companyAccess.includes(t.id)).map(t=>({value:t.id,label:t.code+" - "+t.name})))}).catch(e=>{console.log(e)}).finally(()=>this.state.fetchingCompanies=!1)},async fetchDealerships(){this.state.fetchingDealers=!0,await Te.fetchRecords({includes:["departments"],dealers:this.dealershipAccess}).then(e=>{e.status==200&&(this.dealers=e.data.data.filter(t=>this.dealershipAccess.includes(t.id)))}).catch(e=>{console.error(e)}).finally(()=>this.state.fetchingDealers=!1)},async fetchEmployees(){this.state.fetchingEmployees=!0,await ne.fetchAllEmployeeRecords(this.form).then(e=>{e.status==200&&(this.employees=e.data.map(t=>({...t,name:`${t.lastname}, ${t.firstname} (${t.employee_id})`})),this.state.showEmployees=!0)}).catch(e=>{console.log(e)}).finally(()=>this.state.fetchingEmployees=!1)},async fetchCutOff(){this.form.payroll_date&&this.form.company_id&&await de.fetchCutOff({company_id:this.form.company_id,payroll_date:this.form.payroll_date}).then(e=>{if(e.status==200){this.period=e.data;const{date_range:t,...i}=this.period;this.form={...this.form,...i};return}})},async fetchRecords(){this.state.isLoading=!0,await O.fetchRecords({dealers:this.dealershipAccess}).then(e=>{if(e.status==200){this.items=e.data.data;return}}).catch(e=>console.error(e)).finally(()=>this.state.isLoading=!1)},async fetchProcessedRecords(){this.form.payroll_date&&this.form.company_id&&this.form.dealership_id&&(this.state.showPostingRecords=!1,await O.fetchProcessedRecords({company_id:this.form.company_id,payroll_date:this.form.payroll_date,dealership_id:this.form.dealership_id}).then(e=>{if(e.status==200){console.log("this.processedRecords",e.data),this.processedRecords=e.data,this.state.showProcessedRecords=!0,this.fetchCompletedDepartments();return}}))},async proceedProcessing(){await this.fetchEmployees(),this.state.showProcessedRecords=!1,this.state.showSummary=!0,this.processedRecords&&this.employees.forEach(e=>{const t=this.processedRecords.details.find(r=>r.employee_id==e.employee_id)||this.processedRecords.attendance.timelog.some(r=>r.employee_id==e.employee_id)||this.processedRecords.attendance.schedule.some(r=>r.employee_id==e.employee_id)||this.processedRecords.attendance.leave.some(r=>r.employee_id==e.employee_id)||this.processedRecords.attendance.tardiness.some(r=>r.employee_id==e.employee_id)||this.processedRecords.attendance.undertime.some(r=>r.employee_id==e.employee_id)||this.processedRecords.attendance.holiday.some(r=>r.employee_id==e.employee_id)||this.processedRecords.attendance.overtime.some(r=>r.employee_id==e.employee_id)||this.processedRecords.attendance.night_differential.some(r=>r.employee_id==e.employee_id)||this.processedRecords.attendance.absent.some(r=>r.employee_id==e.employee_id)||this.processedRecords.attendance.dailyWorkHours.some(r=>r.employee_id==e.employee_id),i=this.processedRecords.details.find(r=>r.employee_id==e.employee_id&&r.work_hours==0);if(t){const r={timelog:this.processedRecords.attendance.timelog.filter(l=>l.employee_id==e.employee_id),schedule:this.processedRecords.attendance.schedule.filter(l=>l.employee_id==e.employee_id),leave:this.processedRecords.attendance.leave.filter(l=>l.employee_id==e.employee_id),ob:this.processedRecords.attendance.ob.filter(l=>l.employee_id==e.employee_id),offset:this.processedRecords.attendance.offset.filter(l=>l.employee_id==e.employee_id),tardiness:this.processedRecords.attendance.tardiness.filter(l=>l.employee_id==e.employee_id),undertime:this.processedRecords.attendance.undertime.filter(l=>l.employee_id==e.employee_id),holiday:this.processedRecords.attendance.holiday.filter(l=>l.employee_id==e.employee_id),overtime:this.processedRecords.attendance.overtime.filter(l=>l.employee_id==e.employee_id),night_differential:this.processedRecords.attendance.night_differential.filter(l=>l.employee_id==e.employee_id),absent:this.processedRecords.attendance.absent.filter(l=>l.employee_id==e.employee_id),dailyWorkHours:this.processedRecords.attendance.dailyWorkHours.filter(l=>l.employee_id==e.employee_id),workDays:this.processedRecords.details.filter(l=>l.employee_id==e.employee_id).map(l=>l.work_days).toString(),actualWorkDays:this.processedRecords.details.filter(l=>l.employee_id==e.employee_id).map(l=>l.actual_work_days).toString()};e.employee_id==60653&&(console.log("hasAttendanceRecords"),console.log(t)),this.attendance.find(l=>l.employee_id==e.employee_id)||this.attendance.push({employee_id:e.employee_id,department_id:e.department_id,data:r,hasAttendance:t,hasWarning:i})}})},reload(){this.employees=null,this.period=null,this.form={payroll_date:null,company_id:null,dealership_id:null},this.selectedRow=null,this.selectedEmployee=null,this.selectedEmployeeName=null,this.processingEmployee=null,this.selectedDealer=null,this.selectedDepartment=null,this.state={isLoading:!1,isEdit:!1,isDeleting:!1,showFormPanel:!0,showEmployees:!1,fetchingEmployees:!1,processStatus:null,fetchingPayrollDates:!1,fetchingCompanies:!1,fetchingDealers:!1,cancelProcessing:!1,showPostingRecords:!0,showProcessedRecords:!1,showProcessingSection:!1,showProcessButton:!1,showPostButton:!1,showUnpostButton:!1,showSummary:!1},this.noDataMessage=null,this.queryEmployee=null,this.attendanceQuery=null,this.totalEmployees=0,this.processedEmployees=0,this.attendance=[],this.attendanceForm=[],this.completedDepartments=[],this.processedRecords=null,this.selectedTimelog=null,this.startTime=null,this.elapsedTime=null,this.fetchRecords()},handleSelectDealer({row:e,index:t}){console.log("rowxxx"),console.log(e),e&&(this.form.dealership_id=e?e.dealership_id:null,this.departments=e.departments,this.fetchProcessedRecords(),this.state.showPostButton=!e.posted&&e.created,this.state.showUnpostButton=e.posted&&!e.released,this.state.showProcessButton=!e.posted)},handleSelectRecord({row:e,index:t}){this.form.payroll_date=e?e.payroll_date:null,this.form.company_id=e?e.company_id:null,this.fetchCompletedDepartments(),this.fetchCutOff()},handleEmployeeClick({row:e,index:t}){this.state.showProcessedRecords=!1,e!==null&&(this.selectedEmployee=e.employee_id,this.selectedEmployeeName=e.lastname+", "+e.firstname,this.selectedEmployeeDetail=e),this.resetTimelogForm(),this.state.showTimeLogEdit=!1},handleSelectPayrollDate(e){this.form.payroll_date=e,this.fetchCompletedDepartments(),this.fetchCutOff()},handleSelectCompany(e){this.form.company_id=e,this.fetchCompletedDepartments(),this.fetchCutOff()},searchEmployee(e){this.queryEmployee=e},handleSearchAttendance(e){this.attendanceQuery=e},formatElapsedTime(e){const t=String(Math.floor(e/3600)).padStart(2,"0"),i=String(Math.floor(e%3600/60)).padStart(2,"0"),r=String(e%60).padStart(2,"0");return`${t}:${i}:${r}`},confirmProcess(){this.$swal.fire({title:"Are you sure you want to process this record?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No"}).then(e=>{e.value&&this.processAttendance()})},async processAttendance(){this.attendance=[],this.processedRecords=[],this.state.processingAttendance=!0,this.state.showProcessingSection=!0,this.state.showPostingRecords=!1,this.state.showProcessedRecords=!1,this.state.cancelProcessing=!1,this.state.processingError=!1;const e=this.filteredEmployees.length;this.totalEmployees=e,this.processedEmployees=0,this.selectedEmployee=null,this.employeeProgress=0;let t=B();this.startTime=t.format("hh:mm:ss A");let i=0;const r=setInterval(()=>{i=B().diff(t,"seconds"),this.elapsedTime=this.formatElapsedTime(i)},1e3);try{for(let o=0;o<e&&!this.state.cancelProcessing;o++){const l=this.filteredEmployees[o];this.processingEmployee=l,this.employeeProgress=0,await this.processSingleEmployee(l,o)}this.state.processStatus="success"}catch(o){this.state.processStatus="error",console.error("Processing stopped due to error:",o)}finally{this.state.processingAttendance=!1,clearInterval(r)}},async processSingleEmployee(e,t){try{await ne.processAttendance({employee_id:e.employee_id,company_id:this.form.company_id,dealership_id:this.form.dealership_id,department_id:e.department_id,payroll_date:this.form.payroll_date,start_date:this.period.start_date,end_date:this.period.end_date}).then(i=>{if(i.status==200){const r=i.data;e.employee_id==60653&&(console.log("attendanceggg"),console.log(r)),this.updateEmployeeAttendance({employee_id:e.employee_id,department_id:e.department_id,data:r}),this.processedEmployees=t+1,this.employeeProgress=100}})}catch(i){throw this.state.processingError=!0,console.error(`Error processing employee ${e.employee_id}:`,i),i}},async reprocessEmployeeAttendance(){this.totalEmployees=1;const t=this.filteredEmployees.find(i=>i.employee_id=this.selectedEmployee);this.processingEmployee=t,this.employeeProgress=0,await this.processSingleEmployee(t,0,1)},stopProcessing(){this.state.cancelProcessing=!0,this.state.processingAttendance=!1},hideEmployees(){this.state.showEmployees=!1},async saveRecord(){this.state.isSaving=!0,this.form.details=this.attendanceDetails,await O.create(this.form).then(async e=>{e.status==201?(this.reload(),this.$swal.fire({title:"Great!",text:"Record successfully updated.",icon:"success",timer:2e3})):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3})}).catch(e=>console.error(e)).finally(()=>this.state.isSaving=!1)},async submitForm(){this.$swal.fire({title:"Are you sure you want to save this record?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No"}).then(e=>{e.value&&this.saveRecord()})},async postRecord(){this.state.isSaving=!0,await O.postRecord(this.form).then(async e=>{e.status==201?(this.fetchCompletedDepartments(),this.$swal.fire({title:"Great!",text:"Record successfully updated.",icon:"success",timer:2e3}),this.fetchRecords(),this.state.showProcessedRecords=!1,this.state.showPostingRecords=!0,this.state.showPostButton=!1,this.state.showUnpostButton=!1):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3})}).catch(e=>console.error(e)).finally(()=>this.state.isSaving=!1)},async submitPost(){this.$swal.fire({title:"Are you sure you want to post this record?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No"}).then(e=>{e.value&&this.postRecord()})},async unpostRecord(){this.state.isSaving=!0,await O.unpostRecord(this.form).then(async e=>{e.status==201?(this.fetchProcessedRecords(),this.fetchCompletedDepartments(),this.$swal.fire({title:"Great!",text:"Record successfully updated.",icon:"success",timer:2e3}),this.state.showPostButton=!0,this.state.showUnpostButton=!1):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3})}).catch(e=>console.error(e)).finally(()=>this.state.isSaving=!1)},async submitUnpost(){this.$swal.fire({title:"Are you sure you want to unpost this record?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No"}).then(e=>{e.value&&this.unpostRecord()})},async fetchCompletedDepartments(){this.form.payroll_date&&this.form.company_id&&await O.fetchRecord(this.form.payroll_date,{company_id:this.form.company_id}).then(e=>{e.status==200&&(this.completedDepartments=e.data)}).catch(e=>console.error(e))},async fetchTimelogData(){this.state.fetchingTimelogData=!0,await O.fetchTimelogRecords(this.timelogForm).then(e=>{if(e.status==200){const t=e.data;t.timelogs=t.timelogs.map(i=>({...i,time:B(i.datetimelog).format("HH:mm:ss A")})),this.timelogData=t}}).catch(e=>console.error(e)).finally(()=>this.state.fetchingTimelogData=!1)},setSelectedTimelog(e){this.selectedTimelog=e},resetTimelogForm(){this.timelogForm={employee_id:null,date:null,time:null,in_out:"O",reason:null},this.timelogData={}},closeModal(){this.state.showModal=!1},handleChangeTimelog(e){this.state.showTimeLogEdit=!0,this.resetTimelogForm(),this.timelogForm=e,this.fetchTimelogData()},hideTimelogEdit(){this.state.showTimeLogEdit=!1,this.resetTimelogForm()},setAsTimelog(e){this.timelogForm.time=e},async submitUpdateTimelog(){var e,t;try{await Oe().shape({time:me().nullable().required("Time field is required"),reason:me().nullable().required("Reason is required")}).validate(this.timelogForm,{abortEarly:!1});const r={...this.timelogForm,header_id:(t=(e=this.processedRecords)==null?void 0:e.header)==null?void 0:t.id,payroll_date:this.form.payroll_date,company_id:this.form.company_id,dealership_id:this.form.dealership_id,department_id:Array.from(new Set(this.attendance.filter(o=>o.employee_id==this.timelogForm.employee_id).map(o=>o.department_id))).join(",")};this.$swal.fire({title:"Are you sure you want to save this record?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No"}).then(o=>{o.value?this.updateTimelog(r):this.state.showModal=!1})}catch(i){if(i instanceof Fe){const r={};i.inner.forEach(o=>{r[o.path]=o.message}),this.errors=r}}},async updateTimelog(e){await O.updateTimelog(e).then(t=>{t.status===201&&(this.$swal.fire({title:"Great!",text:"Record successfully added. Please wait for your manager to approve.",icon:"success",timer:2e3}),this.fetchTimelogData())}).catch(t=>{console.error(t)})},updateEmployeeAttendance(e){console.log("newAttendance"),console.log(e);const t=e.employee_id;let i=this.attendance.find(r=>r.employee_id===t);console.log("employeeAttendance"),console.log(i),i?(console.log("xxxyy updating"),e.data.timelog&&(i.data.timelog=e.data.timelog),e.data.schedule&&(i.data.schedule=e.data.schedule),e.data.leave&&(i.data.leave=e.data.leave),e.data.ob&&(i.data.ob=e.data.ob),e.data.offset&&(i.data.offset=e.data.offset),e.data.overtime&&(i.data.overtime=e.data.overtime),e.data.night_differential&&(i.data.night_differential=e.data.night_differential),e.data.tardiness&&(i.data.tardiness=e.data.tardiness),e.data.undertime&&(i.data.undertime=e.data.undertime),e.data.absent&&(i.data.absent=e.data.absent),e.data.holiday&&(i.data.holiday=e.data.holiday),e.data.dailyWorkHours&&(i.data.dailyWorkHours=e.data.dailyWorkHours),e.data.workDays&&(i.data.workDays=e.data.workDays),e.data.actualWorkDays&&(i.data.actualWorkDays=e.data.actualWorkDays)):this.attendance.push({employee_id:t,department_id:e.department_id||null,data:{timelog:e.data.timelog||[],schedule:e.data.schedule||[],leave:e.data.leave||[],ob:e.data.ob||[],offset:e.data.offset||[],overtime:e.data.overtime||[],night_differential:e.data.night_differential||[],absent:e.data.absent||[],tardiness:e.data.tardiness||[],undertime:e.data.undertime||[],holiday:e.data.holiday||[],dailyWorkHours:e.data.dailyWorkHours||[],workDays:e.data.workDays||null,actualWorkDays:e.data.actualWorkDays||null}})},updateEmployeeAttendanceByDate(e){const t=e.employee_id,i=(l,m,u)=>{m.forEach(h=>{const p=l.find(_=>_[u]===h[u]);p?Object.assign(p,h):l.push(h)})},r=(l,m)=>{m.forEach(u=>{const h=l.find(p=>p.date===u.date&&p.in_out===u.in_out);h?Object.assign(h,u):l.push(u)})};let o=this.attendance.find(l=>l.employee_id===t);o?(e.data.timelog&&r(o.data.timelog,e.data.timelog),e.data.schedule&&i(o.data.schedule,e.data.schedule,"date"),e.data.leave&&i(o.data.leave,e.data.leave,"date"),e.data.ob&&i(o.data.ob,e.data.ob,"date"),e.data.offset&&i(o.data.offset,e.data.offset,"date"),e.data.overtime&&i(o.data.overtime,e.data.overtime,"date"),e.data.tardiness&&i(o.data.tardiness,e.data.tardiness,"date"),e.data.undertime&&i(o.data.undertime,e.data.undertime,"date"),e.data.holiday&&i(o.data.holiday,e.data.holiday,"date"),e.data.dailyWorkHours&&i(o.data.dailyWorkHours,e.data.dailyWorkHours,"date")):this.attendance.push({employee_id:t,department_id:data.department_id||null,data:{timelog:e.data.timelog||[],schedule:e.data.schedule||[],leave:e.data.leave||[],ob:e.data.ob||[],offset:e.data.offset||[],overtime:e.data.overtime||[],tardiness:e.data.tardiness||[],undertime:e.data.undertime||[],holiday:e.data.holiday||[],dailyWorkHours:e.data.dailyWorkHours||[]}})},showRecords(){this.state.showProcessedRecords=!1,this.state.showProcessingSection=!1,this.state.showPostingRecords=!0},exportTableToPDF(){const e=new Pe("l","mm","a4"),t=e.internal.pageSize,i=t.width||t.getWidth(),r=t.height||t.getHeight();this.formatDateRange(this.filters.rangeDate[0],this.filters.rangeDate[1]);const o="No Timelogs",l=`For payroll date ${this.form.payroll_date}`;e.setFontSize(14).text(o,i/2,15,{align:"center"}),e.setFontSize(10).text(l,i/2,20,{align:"center"});const m=25,u=["#","Employee"],h=this.noTITO.map((p,_)=>[_+1,p.name]);e.autoTable({head:u,body:h,startY:m,margin:{top:5,right:5,bottom:5,left:5},headStyles:{cellPadding:1},bodyStyles:{halign:"left",valign:"top",fontSize:8,cellPadding:{top:2,right:1,bottom:2,left:1}},didDrawPage:function(p){const _=e.internal.getNumberOfPages();e.setFontSize(8).text(`Generated on: ${new Date().toLocaleDateString()}`,5,r-5),e.setFontSize(8).text("",i/2,r-5,{align:"center"}),e.setFontSize(8).text(`Page ${p.pageNumber} of ${_}`,i-5,r-5,{align:"right"})}}),e.save(`${o} - ${l}.pdf`)}},mounted(){this.fetchRecords(),this.fetchPayrollDates(),this.fetchCompanies(),this.fetchDealerships()}},ze={class:"lg:p-2"},Ge={class:"space-y-1"},Ye={class:"relative"},Qe={class:"relative"},Ae={class:"relative border border-slate-300 lg:h-[350px] overflow-y-auto"},Je={key:0,class:"grid place-items-center"},Xe={key:1,class:"grid place-items-center"},Ze={class:"flex gap-1 justify-end"},Ke={class:"relative w-full my-2"},$e={class:"mt-6 flex gap-1 justify-end"},et={class:"left-pane min-h-screen"},tt={class:"flex justify-between mb-2"},st={class:"h-full bg-white rounded border border-slate-200 p-4 relative"},ot={key:0,class:"p-2 text-xl bg-pink-600 text-white rounded italic font-semibold"},lt={key:0},at={key:1},it={class:"border border-slate-600 p-4 flex justify-between text-sm tracking-wide text-slate-700"},rt={class:"space-x-2"},nt={class:"font-semibold"},dt={class:"space-x-2"},mt={class:"font-semibold"},ct={class:"space-x-2"},ut={class:"font-semibold"},ht={class:"h-[600px] overflow-y-auto"},pt={key:0,class:"w-56"},ft={key:1},yt={key:3,class:"space-y-4"},_t={class:"space-y-2"},gt={class:"max-h-[300px] overflow-y-auto"},bt={id:"noTITO"},vt={class:"space-y-2"},xt={class:"max-h-[300px] overflow-y-auto"},kt={id:"noSchedule"},Dt={class:"space-y-2"},Pt={class:"max-h-[300px] overflow-y-auto"},Ct={id:"noSchedule"},wt={key:0,class:"border border-slate-700 p-4"},Tt={class:"flex justify-between text-sm tracking-wide text-slate-700"},Et={class:"relative w-full bg-slate-400 h-6 rounded border border-gray-400"},Rt={class:"absolute inset-0 flex w-full items-center justify-center z-[9]"},St={class:"px-2 text-white rounded"},Ot={key:0,class:"text-sm tracking-widest"},Ft={class:"text-normal font-semibold text-primary-500"},Bt={key:1},It={key:2,class:"font-semibold tracking-widest text-lg text-primary-500 py-2"},Ht={key:3,class:"w-full h-[500px] overflow-y-auto"},Lt=["onClick"],Wt={key:0},Mt={key:1,class:""},Nt={key:2,class:"text-white hover:text-blue-700"},jt={class:"no-padding"},Vt=["onClick"],Ut={key:0},qt={key:0},zt={key:1},Gt={key:1,class:""},Yt={key:2,class:"text-white hover:text-blue-700"},Qt={class:"text-right"},At={class:"text-right"},Jt={key:4,class:"my-4 grid grid-cols-2"},Xt={class:"flex justify-end"},Zt={class:"space-y-4"},Kt={class:"py-2 tracking-wide"},$t={class:"font-bold"},es={class:"font-bold"},ts={class:"font-bold"},ss={key:0,class:"text-blue-500 font-italic"},os={key:1},ls={key:0},as=["onClick"],is={class:"w-full flex gap-3"},rs={key:1,class:"text-red-500"},ns={key:2,class:"text-slate-500 mt-4"},ds={class:""},ms={class:"font-semibold"},cs={class:"font-semibold"},us={class:"font-semibold"},hs={key:3,class:"text-slate-500 mt-4"},ps={class:""},fs={class:"font-semibold"},ys={class:"font-semibold"},_s={class:"font-semibold"},gs={class:"font-semibold"},bs={key:0},vs={class:"relative"},xs={key:0,class:"text-[#ec4899]"},ks={class:"relative"},Ds={key:0,class:"text-[#ec4899]"},Ps={class:"w-full flex gap-1 justify-day_end"};function Cs(e,t,i,r,o,l){const m=P("Loading"),u=P("Multiselect"),h=P("FormGroup"),p=P("Icon"),_=P("Table"),b=P("SubmitButton"),k=P("Panel"),E=P("TextInput"),C=P("ProcessButton"),w=P("Pagination"),D=P("flat-pickr"),H=P("TextArea"),L=P("CloseButton"),y=P("Layout");return d(),T(y,{breadcrumbs:o.breadcrumbs},{default:x(()=>{var N,j,V,U;return[s("div",null,[o.state.isLoading||o.state.fetchingEmployees?(d(),T(m,{key:0,text:"Fetching record"})):f("",!0),o.state.isSaving?(d(),T(m,{key:1,text:"Saving record"})):f("",!0),s("div",ze,[s("form",{class:"space-y-4",onSubmit:t[5]||(t[5]=M(()=>{},["prevent"]))},[s("div",null,[g(k,{active:!o.state.showEmployees,headerTitle:o.title,headerDescription:"Attendance posting for Payroll Preparation"},{default:x(()=>[s("div",Ge,[g(h,{label:"Payroll Date",class:"w-full"},{default:x(()=>[s("div",Ye,[g(u,{modelValue:o.form.payroll_date,"onUpdate:modelValue":t[0]||(t[0]=a=>o.form.payroll_date=a),"close-on-select":!0,searchable:!0,id:"payroll_date",options:o.payrollDateOptions,placeholder:o.state.fetchingPayrollDates?"Loading data":"",disabled:o.state.fetchingPayrollDates,loading:o.state.fetchingPayrollDates,onSelect:l.handleSelectPayrollDate},null,8,["modelValue","options","placeholder","disabled","loading","onSelect"])])]),_:1}),g(h,{label:"Company",class:"w-full"},{default:x(()=>[s("div",Qe,[g(u,{modelValue:o.form.company_id,"onUpdate:modelValue":t[1]||(t[1]=a=>o.form.company_id=a),"close-on-select":!0,searchable:!0,id:"company_id",options:o.companyOptions,placeholder:o.state.fetchingCompanies?"Loading data":"",disabled:o.state.fetchingCompanies,loading:o.state.fetchingCompanies,onSelect:l.handleSelectCompany},null,8,["modelValue","options","placeholder","disabled","loading","onSelect"])])]),_:1}),g(h,{class:"w-full"},{default:x(()=>[s("div",Ae,[this.form.company_id?(d(),T(_,{key:0,noDataMessage:o.noDataMessage,search:!1,columns:o.dealerColumns,rows:l.dealerList,"default-sort-field":o.serverOptions.sortBy,"default-sort-order":o.serverOptions.sortType,onSort:e.handleSort,onSearch:e.handleSearch,thClass:"py-3 bg-blue-50 font-semibold px-1",tdClass:"py-1 px-1",hoverableRow:"",onRowClick:l.handleSelectDealer},{"table-row":x(a=>[a.column.field=="created"?(d(),c("div",Je,[g(p,{icon:a.row.created==!0?"mdi:check":"mdi:remove",class:R(["text-lg",a.row.created==!0?"text-green-500":"text-pink-600"])},null,8,["icon","class"])])):f("",!0),a.column.field=="posted"?(d(),c("div",Xe,[g(p,{icon:a.row.posted==!0?"mdi:check":"mdi:remove",class:R(["text-lg text-center",a.row.posted==!0?"text-green-500":"text-pink-600"])},null,8,["icon","class"])])):f("",!0)]),_:1},8,["noDataMessage","columns","rows","default-sort-field","default-sort-order","onSort","onSearch","onRowClick"])):f("",!0)])]),_:1}),s("div",Ze,[this.state.showPostButton?(d(),T(b,{key:0,onClick:l.submitPost,text:"Post",title:"Post Record"},null,8,["onClick"])):f("",!0),this.state.showUnpostButton?(d(),T(b,{key:1,onClick:l.submitUnpost,text:"Unpost",title:"Unpost Record"},null,8,["onClick"])):f("",!0),this.form.dealership_id?(d(),T(b,{key:2,onClick:l.proceedProcessing,text:"Proceed",title:"Proceed process"},null,8,["onClick"])):f("",!0)])])]),_:1},8,["active","headerTitle"]),g(k,{active:o.state.showEmployees,onClose:l.hideEmployees,headerTitle:"Employees",panelClass:"z-[99] w-[900px]"},{default:x(()=>[s("div",null,[g(h,{label:"Department",labelClass:"tracking-widest uppercase pb-0 mb-0"},{default:x(()=>[s("div",Ke,[g(u,{modelValue:o.selectedDepartment,"onUpdate:modelValue":t[2]||(t[2]=a=>o.selectedDepartment=a),"close-on-select":!0,searchable:!0,id:"selectedDepartment",options:l.departmentOptions},{option:x(({option:a})=>[a.completed?(d(),T(p,{key:0,icon:"mdi:check",class:"text-blue-500 text-lg"})):f("",!0),s("span",{class:R(a.completed?"text-blue-500 font-semibold":"text-slate-600")},n(a.label),3)]),_:1},8,["modelValue","options"])])]),_:1}),g(h,null,{default:x(()=>[s("div",null,[g(E,{modelValue:o.queryEmployee,"onUpdate:modelValue":t[3]||(t[3]=a=>o.queryEmployee=a),class:"",classInput:"h-[40px]"},null,8,["modelValue"])])]),_:1}),g(_,{rows:l.employeeList,columns:o.employeeColumns,search:!1,hoverableRow:"",tableContainerClass:"border border-slate-300 rounded h-[400px]",onRowClick:l.handleEmployeeClick},{"table-row":x(a=>[a.column.field=="name"?(d(),c("div",{key:0,class:R({"text-blue-500 font-semibold":a.row.hasAttendance,"text-pink-600 font-semibold":a.row.hasWarning})},n(a.row.lastname)+", "+n(a.row.firstname)+" ("+n(a.row.employee_id)+") ",3)):f("",!0)]),_:1},8,["rows","columns","onRowClick"]),s("div",$e,[o.attendance.length>0&&(l.overallProgress==100||o.state.showProcessButton)&&!o.state.processingAttendance?(d(),T(b,{key:0,onClick:l.submitForm,text:"Save",class:"border border-success-500 rounded"},null,8,["onClick"])):f("",!0),o.state.showProcessButton?(d(),T(C,{key:1,onClick:l.confirmProcess,text:"Process Attendance",class:"border border-success-500 rounded"},null,8,["onClick"])):f("",!0)])])]),_:1},8,["active","onClose"])]),s("div",et,[s("div",tt,[t[9]||(t[9]=s("div",{class:"text-xl tracking-wide mb-2"},"Attendance Posting",-1)),s("div",null,[o.state.processingAttendance?f("",!0):(d(),c("button",{key:0,class:"rounded border p-2 border-slate-500 bg-white text-slate-500",onClick:t[4]||(t[4]=(...a)=>l.showRecords&&l.showRecords(...a))}," Show Records "))])]),s("div",st,[o.state.processingError?(d(),c("div",ot," Ooops! The processing has stopped prematurely! Please contact the system administrator. ")):f("",!0),o.state.showPostingRecords?(d(),T(_,{key:1,columns:o.columns,rows:o.items,"default-sort-field":o.serverOptions.sortBy,"default-sort-order":o.serverOptions.sortType,onSort:e.handleSort,onSearch:e.handleSearchRecord,thClass:"py-2 border border-slate-200 bg-blue-50 font-semibold px-1 text-xs",tdClass:"py-1 px-1 border border-slate-200 text-xs",hoverableRow:"",onRowClick:l.handleSelectRecord},{"table-row":x(a=>[a.column.field=="company"?(d(),c("div",lt,n(a.row.company?a.row.company.name:null),1)):f("",!0),a.column.field=="dealership"?(d(),c("div",at,n(a.row.dealership?a.row.dealership.name:null),1)):f("",!0)]),"pagination-bottom":x(()=>[g(w,{currentPage:o.serverOptions.page,totalItems:o.totalItems,totalPages:e.totalPages,itemsPerPage:o.serverOptions.rowsPerPage,onChangePage:e.changePage,onChangeItemsPerPage:e.updateItemsPerPage,pageOptions:[5,10,20,50,100],pageNumberClass:""},null,8,["currentPage","totalItems","totalPages","itemsPerPage","onChangePage","onChangeItemsPerPage"])]),_:1},8,["columns","rows","default-sort-field","default-sort-order","onSort","onSearch","onRowClick"])):f("",!0),o.state.showProcessedRecords&&o.processedRecords.header?(d(),c(F,{key:2},[s("div",it,[s("div",rt,[t[10]||(t[10]=s("span",{class:"text-slate-400"},"ID:",-1)),s("span",nt,n(((N=o.processedRecords.header)==null?void 0:N.id)||null),1)]),s("div",dt,[t[11]||(t[11]=s("span",{class:"text-slate-400"},"Reference No:",-1)),s("span",mt,n(((j=o.processedRecords.header)==null?void 0:j.reference_no)||null),1)]),s("div",ct,[t[12]||(t[12]=s("span",{class:"text-slate-400"},"Dealership:",-1)),s("span",ut,n(((U=(V=o.processedRecords.header)==null?void 0:V.dealership)==null?void 0:U.name)||null),1)])]),s("div",ht,[g(_,{rows:l.filteredAttendance,columns:o.attendanceColumns,onSearch:l.handleSearchAttendance,tdClass:"border border-slate-300"},{"table-row":x(a=>[a.column.field=="employee"?(d(),c("div",pt,n(a.row.employee?[a.row.employee.lastname,a.row.employee.firstname].join(", ")+" ("+a.row.employee_id+")":a.row.employee_id),1)):f("",!0),a.column.field=="department"?(d(),c("div",ft,n(a.row.department?a.row.department.name:null),1)):f("",!0)]),"pagination-bottom":x(()=>[g(w,{currentPage:o.serverOptions.page,totalItems:o.totalItems,totalPages:e.totalPages,itemsPerPage:o.serverOptions.rowsPerPage,onChangePage:e.changePage,onChangeItemsPerPage:e.updateItemsPerPage,pageOptions:[5,10,20,50,100],pageNumberClass:""},null,8,["currentPage","totalItems","totalPages","itemsPerPage","onChangePage","onChangeItemsPerPage"])]),_:1},8,["rows","columns","onSearch"])])],64)):o.state.showSummary&&!o.state.processingAttendance&&!l.selectedAttendance?(d(),c("div",yt,[s("div",_t,[t[14]||(t[14]=s("div",{class:"text-xl"},"No Timelog",-1)),s("div",gt,[s("table",bt,[t[13]||(t[13]=s("thead",null,[s("tr",null,[s("th",null,"#"),s("th",null,"Employee"),s("th",null,"Department")])],-1)),s("tbody",null,[(d(!0),c(F,null,I(l.noTITO,(a,S)=>(d(),c("tr",{key:a.employee_id},[s("td",null,n(S+1),1),s("td",null,n(a.name),1),s("td",null,n(a.department_name??null),1)]))),128))])])])]),s("div",vt,[t[16]||(t[16]=s("div",{class:"text-xl"},"No Schedule",-1)),s("div",xt,[s("table",kt,[t[15]||(t[15]=s("thead",null,[s("tr",null,[s("th",null,"#"),s("th",null,"Employee"),s("th",null,"Department")])],-1)),s("tbody",null,[(d(!0),c(F,null,I(l.noSchedule,(a,S)=>(d(),c("tr",{key:a.employee_id},[s("td",null,n(S+1),1),s("td",null,n(a.name),1),s("td",null,n(a.department_name??null),1)]))),128))])])])]),s("div",Dt,[t[18]||(t[18]=s("div",{class:"text-xl"},"Incomplete Time-In / Time-Out",-1)),s("div",Pt,[s("table",Ct,[t[17]||(t[17]=s("thead",null,[s("tr",null,[s("th",null,"#"),s("th",null,"Employee"),s("th",null,"Department"),s("th",null,"Date"),s("th",null,"Time In"),s("th",null,"Time Out")])],-1)),s("tbody",null,[(d(!0),c(F,null,I(l.incompleteTITO,(a,S)=>(d(),c("tr",{key:a.employee_id},[s("td",null,n(S+1),1),s("td",null,n(a.name),1),s("td",null,n(a.department_name??null),1),s("td",null,n(a.date??null),1),s("td",null,n(a.time_in?a.time_in.time:null),1),s("td",null,n(a.time_out?a.time_out.time:null),1)]))),128))])])])])])):(d(),c(F,{key:4},[o.processingEmployee?(d(),c("div",wt,[s("div",Tt,[s("div",null,[t[19]||(t[19]=s("span",{class:"text-slate-500"},"Processed employees: ",-1)),v(" "+n(o.processedEmployees)+" / "+n(o.totalEmployees),1)]),s("div",null,[t[20]||(t[20]=s("span",{class:"text-slate-500"},"Start Time: ",-1)),s("span",null,n(o.startTime),1)]),s("div",null,[t[21]||(t[21]=s("span",{class:"text-slate-500"},"Elapsed Time: ",-1)),s("span",null,n(o.elapsedTime),1)])]),s("div",Et,[s("div",Rt,[s("span",St,n(l.overallProgress)+"% Complete ",1)]),s("div",{class:R(["bg-blue-500 h-6 text-center relative",l.overallProgress<100?"rounded-l":"rounded"]),style:pe({width:l.overallProgress+"%"})},null,6)]),l.overallProgress!=100?(d(),c("div",Ot,[t[22]||(t[22]=s("span",{class:"text-slate-500"}," Processing: ",-1)),s("span",Ft,n(o.processingEmployee.name),1)])):f("",!0)])):f("",!0),o.state.processingAttendance?(d(),c("div",Bt,t[23]||(t[23]=[s("video",{controls:"",autoplay:"",loop:""},[s("source",{src:Ue,type:"video/mp4"})],-1),v('" ')]))):f("",!0),l.selectedAttendance?(d(),c("div",It,n(o.selectedEmployeeName),1)):f("",!0),l.selectedAttendance?(d(),c("div",Ht,[s("table",null,[t[27]||(t[27]=s("thead",{class:"sticky top-0 z-10"},[s("tr",{class:"bg-white"},[s("th",null,"Date"),s("th",null,"Time-In"),s("th",null,"Time-Out"),s("th",null,"Schedule"),s("th",null,"Absent"),s("th",null,"Late"),s("th",null,"UT"),s("th",null,"OT"),s("th",null,"ND"),s("th",null,"Leave"),s("th",null,"OB"),s("th",null,"Offset"),s("th",null,"CDO"),s("th",null,"Holiday")])],-1)),s("tbody",null,[(d(!0),c(F,null,I(l.selectedAttendance,(a,S)=>{var W,q,z,G,Y,Q,A,J,X,Z,K,$,ee,te,se,oe,le,ae,ie;return d(),c("tr",{key:S},[s("td",{class:R(a.hasWarning?"text-red-500":null)},n(a.date),3),s("td",null,[s("button",{class:"w-full text-slate-900 bg-white hover:text-blue-700 hover:bg-blue-700 hover:bg-opacity-[0.12] text-center p-1",onClick:he=>l.handleChangeTimelog({employee_id:o.selectedEmployee,time_keeping_id:o.selectedEmployeeDetail.time_keeping_id??null,date:a.date,time:a.timelog.in,in_out:"I"})},[(W=a.timelog)!=null&&W.in&&(!((q=a.ob)!=null&&q.from_time)||a.timelog.in<=a.ob.from_time)?(d(),c("span",Wt,n(a.timelog.in),1)):(z=a.ob)!=null&&z.from_time?(d(),c("span",Mt,[v(n(l.Helper.formatTime(a.ob.from_time,"HH:mm:ss"))+" ",1),t[24]||(t[24]=s("span",{class:"text-blue-500 font-bold text-lg"},"*",-1))])):(d(),c("span",Nt,"Edit"))],8,Lt)]),s("td",jt,[s("button",{class:"w-full text-slate-900 bg-white hover:bg-blue-700 hover:bg-opacity-[0.12] hover:text-blue-700 text-center p-1",onClick:he=>l.handleChangeTimelog({employee_id:o.selectedEmployee,time_keeping_id:o.selectedEmployeeDetail.time_keeping_id??null,date:a.date,time:a.timelog.out,in_out:"O"})},[(G=a.timelog)!=null&&G.out&&(!((Y=a.ob)!=null&&Y.to_time)||a.timelog.out>=a.ob.to_time)?(d(),c("span",Ut,[((Q=a.ob)==null?void 0:Q.to_time)>="00:00:00"&&((A=a.ob)==null?void 0:A.to_time)<="05:00:00"?(d(),c("div",qt,[v(n(l.Helper.formatTime((J=a.ob)==null?void 0:J.to_time,"HH:mm:ss"))+" ",1),t[25]||(t[25]=s("span",{class:"text-blue-500 font-bold text-lg"},"*",-1))])):(d(),c("div",zt,n(a.timelog.out),1))])):(X=a.ob)!=null&&X.to_time?(d(),c("span",Gt,[v(n(l.Helper.formatTime((Z=a.ob)==null?void 0:Z.to_time,"HH:mm:ss"))+" ",1),t[26]||(t[26]=s("span",{class:"text-blue-500 font-bold text-lg"},"*",-1))])):(d(),c("span",Yt,"Edit"))],8,Vt)]),s("td",null,n((K=a.schedule)!=null&&K.restday?"Day-off":[($=a==null?void 0:a.schedule)==null?void 0:$.schedule_in,(ee=a==null?void 0:a.schedule)==null?void 0:ee.schedule_out].join("-")),1),s("td",null,n(a.absent?parseFloat((te=a.absent)==null?void 0:te.no_of_hours)+(((se=a.absent)==null?void 0:se.no_of_hours)>1?" hrs":" hr"):a.leave&&(a.leave.no_of_hours==4||a.leave.no_of_hours==5)&&a.leave.without_pay==1?parseFloat(a.leave.no_of_hours)+(a.leave.ho_of_hours>1?" hrs":" hr"):""),1),s("td",null,n(a.tardiness?l.Helper.formatHoursMinute((oe=a.tardiness)==null?void 0:oe.no_of_minutes):null),1),s("td",null,n(a.undertime?l.Helper.formatHoursMinute((le=a.undertime)==null?void 0:le.no_of_minutes):null),1),s("td",Qt,n(a.overtime?l.Helper.formatHoursMinute(a.overtime.no_of_hours,"hours"):null),1),s("td",At,n(a.night_differential?l.Helper.formatHoursMinute(a.night_differential.no_of_hours,"hours"):null),1),s("td",null,n(a.leave?a.leave.no_of_hours+" hrs"+(a.leave.without_pay==1?" (Without Pay)":""):""),1),s("td",null,n(a.ob?l.Helper.formatTime(a.ob.from_time)+" - "+l.Helper.formatTime(a.ob.to_time):null),1),s("td",null,n(a.offset?l.Helper.formatTime(a.offset.from_time)+" - "+l.Helper.formatTime(a.offset.to_time):null),1),s("td",null,n((ae=a.schedule)!=null&&ae.restday&&a.holiday&&a.holiday.type==null?a.holiday.no_of_hours+" hrs":null),1),s("td",null,n((ie=a.schedule)==null?void 0:ie.holiday)+" "+n(a.schedule&&!a.schedule.restday&&a.holiday?"("+a.holiday.no_of_hours+" hrs)":null),1)])}),128))])])])):f("",!0),l.selectedAttendance?(d(),c("div",Jt,[t[28]||(t[28]=s("div",{class:"text-sm text-slate-600 tracking-wide px-2"},[s("div",{class:"font-semibold"},"Notes:"),s("span",{class:"text-blue-500 text-lg font-bold"},"*"),s("span",null,"OB Time"),s("div",null,[v(" The format for late, undertime, overtime and night diff is now "),s("span",{class:"font-semibold"},[v("hours"),s("span",{class:"font-black"},"."),v("minutes")])])],-1)),s("div",Xt,[o.state.showProcessButton?(d(),T(b,{key:0,onClick:M(l.reprocessEmployeeAttendance,["stop"]),text:"Re-process",class:""},null,8,["onClick"])):f("",!0)])])):f("",!0)],64))])])],32)]),g(k,{headerTitle:"Timelog Details",active:o.state.showTimeLogEdit,onClose:l.hideTimelogEdit,horizontalPosition:"ltr:right-[400px] rtl:left-0",backgroundColor:"bg-amber-50"},{default:x(()=>[s("div",Zt,[s("div",null,[s("form",{onSubmit:t[8]||(t[8]=M(()=>{},["prevent"])),class:"space-y-4"},[s("div",Kt,[s("div",null,[t[29]||(t[29]=v(" Name: ")),s("span",$t,n(o.selectedEmployeeName),1)]),s("div",null,[t[30]||(t[30]=v(" Date: ")),s("span",es,n(o.timelogForm.date),1)]),s("div",null,[t[31]||(t[31]=v(" In/Out: ")),s("span",ts,n(o.timelogForm.in_out=="I"?"In":"Out"),1)])]),o.state.fetchingTimelogData?(d(),c("div",ss," Fetching Timelog Details ... ")):(d(),c("div",os,[o.timelogData.timelogs&&o.timelogData.timelogs.length>0?(d(),c("div",ls,[t[32]||(t[32]=s("div",{class:"font-semibold tracking-widest"},"Timelogs",-1)),(d(!0),c(F,null,I(o.timelogData.timelogs,(a,S)=>(d(),c("div",{key:S,class:"border-b border-slate-300 py-1"},[s("button",{class:"hover:bg-blue-50",onClick:W=>l.setAsTimelog(a.time)},[s("div",is,[s("div",null,n(a.time),1),s("div",null,n(a.in_out=="I"?"In":"Out"),1)])],8,as)]))),128))])):(d(),c("div",rs," No timelog records ")),o.timelogData.time_adjustment?(d(),c("div",ns,[t[37]||(t[37]=s("div",{class:"text-pink-600 font-semibold"}," Employee has existing time adjustment request ",-1)),s("div",ds,[s("div",null,[t[33]||(t[33]=v(" Date: ")),s("span",ms,n(o.timelogData.time_adjustment.date),1)]),s("div",null,[t[34]||(t[34]=v(" Time: ")),s("span",cs,n(o.timelogData.time_adjustment.time),1)]),s("div",null,[t[35]||(t[35]=v(" In/Out: ")),s("span",us,n(o.timelogData.time_adjustment.in_out=="I"?"In":"Out"),1)]),s("div",null,[t[36]||(t[36]=v(" Status: ")),s("span",{class:R(["font-semibold",o.timelogData.timelog_adjustment.status==2?"text-emerald-500":"text-amber-600"])},n(o.timelogData.time_adjustment.status==2?"Approved":"For Approval"),3)])])])):f("",!0),o.timelogData.timelog_edit?(d(),c("div",hs,[t[43]||(t[43]=s("div",{class:"text-pink-500 font-semibold"}," Employee has existing timelog edit ",-1)),s("div",ps,[s("div",null,[t[38]||(t[38]=v(" Date: ")),s("span",fs,n(o.timelogData.timelog_edit.date),1)]),s("div",null,[t[39]||(t[39]=v(" Time: ")),s("span",ys,n(o.timelogData.timelog_edit.time),1)]),s("div",null,[t[40]||(t[40]=v(" In/Out: ")),s("span",_s,n(o.timelogData.timelog_edit.in_out=="I"?"In":"Out"),1)]),s("div",null,[t[41]||(t[41]=v(" Reason: ")),s("span",gs,n(o.timelogData.timelog_edit.reason),1)]),s("div",null,[t[42]||(t[42]=v(" Status: ")),s("span",{class:R(["font-semibold",o.timelogData.timelog_edit.approved==1?"text-emerald-500":"text-amber-600"])},n(o.timelogData.timelog_edit.approved==1?"Approved":"For Approval"),3)])])])):f("",!0),s("div",{class:R(["mt-4 space-y-4",{"p-4 border border-primary-600 rounded bg-slate-100":!o.timelogData.timelog_edit&&!o.timelogData.time_adjustment}])},[!o.timelogData.time_adjustment&&!o.timelogData.timelog_edit?(d(),c("div",bs,[g(h,{label:"Edit Timelog",labelClass:"font-semibold"},{default:x(()=>[s("div",vs,[g(D,{modelValue:o.timelogForm.time,"onUpdate:modelValue":t[6]||(t[6]=a=>o.timelogForm.time=a),class:"form-control h-12 bg-white",placeholder:"Time",config:{enableTime:!0,noCalendar:!0,dateFormat:"H:i"}},null,8,["modelValue"]),o.errors.time?(d(),c("div",xs,n(o.errors.time),1)):f("",!0)])]),_:1}),g(h,{label:"Reason"},{default:x(()=>[s("div",ks,[g(H,{modelValue:o.timelogForm.reason,"onUpdate:modelValue":t[7]||(t[7]=a=>o.timelogForm.reason=a)},null,8,["modelValue"]),o.errors.reason?(d(),c("div",Ds,n(o.errors.reason),1)):f("",!0)])]),_:1})])):f("",!0),s("div",Ps,[(!o.timelogData.time_adjustment||o.timelogData.time_adjustment.length==0)&&(!o.timelogData.timelog_edit||o.timelogData.timelog_edit.length==0)?(d(),T(b,{key:0,onClick:l.submitUpdateTimelog},null,8,["onClick"])):f("",!0),g(L,{onClick:l.hideTimelogEdit},null,8,["onClick"])])],2)]))],32)])])]),_:1},8,["active","onClose"])])]}),_:1},8,["breadcrumbs"])}const po=ue(qe,[["render",Cs],["__scopeId","data-v-87419f69"]]);export{po as default};
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0 |
proxy
|
phpinfo
|
Settings