From b80737d21059e07d955b28b28597cc1c36dde573 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Wed, 23 Oct 2024 21:09:42 +0200 Subject: [PATCH] add download button to employee page --- src/lib/components/AnalystEstimate.svelte | 4 +- .../[tickerID]/stats/employees/+page.svelte | 1085 +++++++++-------- 2 files changed, 608 insertions(+), 481 deletions(-) diff --git a/src/lib/components/AnalystEstimate.svelte b/src/lib/components/AnalystEstimate.svelte index 80576b57..55f3465c 100644 --- a/src/lib/components/AnalystEstimate.svelte +++ b/src/lib/components/AnalystEstimate.svelte @@ -332,9 +332,9 @@ function findIndex(data) { - + {#each xData as item} - + {/each} diff --git a/src/routes/stocks/[tickerID]/stats/employees/+page.svelte b/src/routes/stocks/[tickerID]/stats/employees/+page.svelte index b9672a0e..fdc31a0c 100644 --- a/src/routes/stocks/[tickerID]/stats/employees/+page.svelte +++ b/src/routes/stocks/[tickerID]/stats/employees/+page.svelte @@ -1,555 +1,682 @@ - - + + + + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} + {$displayCompanyName} ({$stockTicker}) Number of Employees · stocknear + + - - - -{$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ''} {$displayCompanyName} ({$stockTicker}) Number of Employees · stocknear - - - - - - - - - - - - - - + + + + + + + + + + +
+
+
+
+
+

+ Employees +

- -
-
-
-
-
-

- Employees -

- - -
- - - {#if employeeHistory?.length !== 0 && !dateDistance} -
- {$displayCompanyName} - had - {abbreviateNumber(employees)} - employees on - {new Date(employeeHistory[employeeHistory?.length -1]['filingDate'])?.toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' })}. - The number of employees {changeRate >=0 ? 'increased' : 'decreased'} by - {abbreviateNumber(changeRate)} - or - - {growthRate}% - - compared to the previous year. -
- {:else if employeeHistory?.length !== 0 && dateDistance} - {$displayCompanyName} had {abbreviateNumber(employees)} employees on - {new Date(employeeHistory[employeeHistory?.length -1]['filingDate'])?.toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' })}. - Since then, the company has not submitted any additional employee data for more than a year. - {:else} - No employee history for {$displayCompanyName}. Probably, no records of past employees. - {/if} -
- -
+
+ - -
-
- -
- {abbreviateNumber(employees)} -
-
-
- - -
- {#if dateDistance} - n/a - {:else} - {abbreviateNumber(changeRate)} - {/if} -
-
-
- - -
- {#if growthRate >= 0} - - - +{growthRate}% - - {:else if growthRate < 0} -
- - {growthRate}% -
- {:else} - - n/a - - {/if} -
-
- -
- - - - - - -
- -

- Employees History -

- - -
-
- - - - - - - Select Type - - - - sortBy = 'Total'} class="cursor-pointer hover:bg-[#27272A]"> - Total - - sortBy = 'Change'} class="cursor-pointer hover:bg-[#27272A]"> - Change - - sortBy = 'Growth'} class="cursor-pointer hover:bg-[#27272A]"> - Growth - - - - - - -
-
- -
- - - - - {#if historyList?.length !== 0} - - - {#if sortBy === 'Total'} -
- -
- {:else if sortBy === 'Change'} -
- -
- {:else if sortBy === 'Growth'} -
- -
- {/if} - -
-
YearYear{"FY" + item}{"FY" + item}
- - - - - - - - - - {#each historyList as item, index} - - - - - - - {/each} - - -
- Date - - Employees - - Change - - Growth -
- {new Date(item?.filingDate)?.toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' })} - - {new Intl.NumberFormat("en").format(item?.employeeCount)} - - {abbreviateNumber(item?.employeeCount-historyList[index+1]?.employeeCount)} - - {#if index+1-historyList?.length === 0} - 0.00% - {:else} - {#if (item?.employeeCount- historyList[index+1]?.employeeCount) > 0} - - +{(((item?.employeeCount-historyList[index+1]?.employeeCount) / item?.employeeCount) * 100 )?.toFixed(2)}% - - {:else if (item?.employeeCount - historyList[index+1]?.employeeCount ) < 0} - - -{(((historyList[index+1]?.employeeCount - item?.employeeCount) / item?.employeeCount) * 100 )?.toFixed(2)}% - - {:else} - 0.00% - {/if} - {/if} -
- - - - {:else} -

- No history found -

- {/if} - - - - - - - + {#if employeeHistory?.length !== 0 && !dateDistance} +
+ {$displayCompanyName} + had + {abbreviateNumber(employees)} + employees on + {new Date( + employeeHistory[employeeHistory?.length - 1]["filingDate"], + )?.toLocaleString("en-US", { + month: "short", + day: "numeric", + year: "numeric", + daySuffix: "2-digit", + })}. The number of employees {changeRate >= 0 + ? "increased" + : "decreased"} by + {abbreviateNumber(changeRate)} + or + = 0 ? "text-[#37C97D]" : "text-[#FF2F1F]"} + > + {growthRate}% + + compared to the previous year. +
+ {:else if employeeHistory?.length !== 0 && dateDistance} + {$displayCompanyName} had {abbreviateNumber(employees)} employees on + {new Date( + employeeHistory[employeeHistory?.length - 1]["filingDate"], + )?.toLocaleString("en-US", { + month: "short", + day: "numeric", + year: "numeric", + daySuffix: "2-digit", + })}. Since then, the company has not submitted any additional + employee data for more than a year. + {:else} + No employee history for {$displayCompanyName}. Probably, no + records of past employees. + {/if} + + +
+
+ +
+ {abbreviateNumber(employees)} +
+
+
+ + +
+ {#if dateDistance} + n/a + {:else} + {abbreviateNumber(changeRate)} + {/if} +
+
+
+ + +
+ {#if growthRate >= 0} + + +{growthRate}% + + {:else if growthRate < 0} +
+ {growthRate}% +
+ {:else} + n/a + {/if} +
+
+
+ +
+

Employees History

+ +
+
+ + + + + + + Select Type + + + + (sortBy = "Total")} + class="cursor-pointer hover:bg-[#27272A]" + > + Total + + (sortBy = "Change")} + class="cursor-pointer hover:bg-[#27272A]" + > + Change + + (sortBy = "Growth")} + class="cursor-pointer hover:bg-[#27272A]" + > + Growth + + + + +
+ +
+
+ + {#if historyList?.length !== 0} + {#if sortBy === "Total"} +
+ +
+ {:else if sortBy === "Change"} +
+ +
+ {:else if sortBy === "Growth"} +
+ +
+ {/if} + +
+ + + + + + + + + + + {#each historyList as item, index} + + + + + + + {/each} + +
+ Date + + Employees + + Change + + Growth +
+ {new Date(item?.filingDate)?.toLocaleString("en-US", { + month: "short", + day: "numeric", + year: "numeric", + daySuffix: "2-digit", + })} + + {new Intl.NumberFormat("en").format(item?.employeeCount)} + + {abbreviateNumber( + item?.employeeCount - + historyList[index + 1]?.employeeCount, + )} + + {#if index + 1 - historyList?.length === 0} + 0.00% + {:else if item?.employeeCount - historyList[index + 1]?.employeeCount > 0} + + +{( + ((item?.employeeCount - + historyList[index + 1]?.employeeCount) / + item?.employeeCount) * + 100 + )?.toFixed(2)}% + + {:else if item?.employeeCount - historyList[index + 1]?.employeeCount < 0} + + -{( + ((historyList[index + 1]?.employeeCount - + item?.employeeCount) / + item?.employeeCount) * + 100 + )?.toFixed(2)}% + + {:else} + 0.00% + {/if} +
+
+ {:else} +

+ No history found +

+ {/if} - - - - - - + + + + \ No newline at end of file +