Skip to content

delete: remove ShiftTicketCenter component and its associated logic#40

Merged
xukki241 merged 1 commit intomainfrom
shift
Mar 28, 2026
Merged

delete: remove ShiftTicketCenter component and its associated logic#40
xukki241 merged 1 commit intomainfrom
shift

Conversation

@xukki241
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings March 28, 2026 22:54
@xukki241 xukki241 merged commit e1376a9 into main Mar 28, 2026
6 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the HR shift ticket/shift swap UI pages and updates seed/verification scripts to match expanded database tables and updated seed schemas.

Changes:

  • Deleted ShiftTicketCenter and related HR ticket pages (ShiftSwapTicketsPage, ShiftLeaveTicketsPage, EmployeeShiftRequestPage).
  • Enhanced DB seed verification to ensure additional tables are populated after seeding.
  • Updated seed generation mappings and seed SQL inserts to use explicit column lists (including updated advertisements schema).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
frontend/src/pages/HR/ShiftTicketCenter.jsx Deleted the ShiftTicketCenter page and supporting helper logic.
frontend/src/pages/HR/ShiftSwapTicketsPage.jsx Deleted the swap-ticket quick processing page.
frontend/src/pages/HR/ShiftLeaveTicketsPage.jsx Deleted the leave-ticket processing page.
frontend/src/pages/HR/EmployeeShiftRequestPage.jsx Deleted the employee self-service shift request + ticket tracking page.
deploy/scripts/reset-db-and-seed.sh Added more table count checks to seed verification output and failure conditions.
deploy/gen_fix_seed.js Expanded table-to-column mappings for seed-fix generation.
deploy/fix_seed.sql Switched multiple inserts to explicit columns; updated advertisements seed rows to new schema layout.
backend/src/main/resources/data.sql Updated advertisements seed rows to new schema layout (explicit columns).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +166 to +173
PURCHASE_ORDERS_COUNT="$(count_table purchase_orders)"
INVENTORY_COUNTS_COUNT="$(count_table inventory_counts)"
DISPOSAL_VOUCHERS_COUNT="$(count_table disposal_vouchers)"
ADVERTISEMENTS_COUNT="$(count_table advertisements)"
TICKETS_COUNT="$(count_table tickets)"
LOYALTY_GIFTS_COUNT="$(count_table loyalty_gifts)"
echo "users=$USERS_COUNT, products=$PRODUCTS_COUNT, variants=$VARIANTS_COUNT, inventory_stock=$STOCK_COUNT, sale_orders=$SALE_ORDERS_COUNT, sale_order_items=$SALE_ORDER_ITEMS_COUNT, sale_order_histories=$SALE_ORDER_HISTORIES_COUNT, tickets=$TICKETS_COUNT, loyalty_gifts=$LOYALTY_GIFTS_COUNT"
echo "purchase_orders=$PURCHASE_ORDERS_COUNT, inventory_counts=$INVENTORY_COUNTS_COUNT, disposal_vouchers=$DISPOSAL_VOUCHERS_COUNT, advertisements=$ADVERTISEMENTS_COUNT"
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR title focuses on removing ShiftTicketCenter, but this change set also modifies deploy/seed verification logic (and the PR also deletes multiple other HR pages). To keep review/rollback safer, either (a) update the PR title/description to reflect the seed changes too, or (b) split seed/DB verification changes into a separate PR.

Copilot uses AI. Check for mistakes.
Comment on lines +301 to 304
if [ "$USERS_COUNT" = "0" ] || [ "$PRODUCTS_COUNT" = "0" ] || [ "$VARIANTS_COUNT" = "0" ] || [ "$STOCK_COUNT" = "0" ] || [ "$SALE_ORDERS_COUNT" = "0" ] || [ "$SALE_ORDER_ITEMS_COUNT" = "0" ] || [ "$SALE_ORDER_HISTORIES_COUNT" = "0" ] || [ "$TICKETS_COUNT" = "0" ] || [ "$LOYALTY_GIFTS_COUNT" = "0" ] || [ "$PURCHASE_ORDERS_COUNT" = "0" ] || [ "$INVENTORY_COUNTS_COUNT" = "0" ] || [ "$DISPOSAL_VOUCHERS_COUNT" = "0" ] || [ "$ADVERTISEMENTS_COUNT" = "0" ]; then
log "ERROR" "Seed finished but one or more critical tables are empty."
exit 1
fi
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes seed success contingent on purchase_orders, inventory_counts, disposal_vouchers, and advertisements being non-empty. Because count_table returns 0 when a table is missing, this can also fail hard in environments where those tables aren’t present or intentionally not seeded. Consider gating these checks behind a flag, or explicitly checking table existence before treating emptiness as a fatal condition (or classifying them as non-critical if appropriate).

Copilot uses AI. Check for mistakes.
-- ADVERTISEMENTS & AD CONTRACTS
-- =============================================================================
INSERT INTO `advertisements` VALUES (1,'#ffffff','marketing@smalltrend.vn','Nguyễn Văn Marketing','0901-234-567','2026-12-31','AD-2026-LEFT-001','2026-01-01',5000000.00,'2026-03-18 01:40:09.000000','#4f46e5','Mua ngay','https://images.unsplash.com/photo-1607082348824-0a96f2a4b9da?w=400&q=80',0,'','Hợp đồng quảng cáo nội bộ, ưu tiên slot trái toàn năm 2026','Thanh toán hàng quý, net 30 ngày','LEFT','SmallTrend Brand','Ưu đãi cuối tuần cho mọi sản phẩm','Mega Sale 50% OFF','2026-03-19 15:39:05.966119'),(2,'#f0fdf4','ads@expressdelivery.vn','Trần Thị Logistics','0912-345-678','2026-06-30','AD-2026-RIGHT-001','2026-01-01',12000000.00,'2026-03-18 01:40:09.000000','#059669','Đặt ngay','https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?w=400&q=80',0,'','Đối tác giao hàng nhanh khu vực HCM & Hà Nội. Hợp đồng gia hạn mỗi 6 tháng.','Thanh toán hàng tháng vào ngày 15','RIGHT','Express Delivery Partner','Đơn từ 200.000đ — giao trong 2h','Giao hàng miễn phí','2026-03-19 14:04:19.055381'),(3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-03-19 14:03:25.455314',NULL,NULL,'https://res.cloudinary.com/didvvefmu/image/upload/v1773928997/smalltrend/crm/ads/ymypqgpfxq3wvajk8ycq.jpg',0,NULL,NULL,NULL,'LEFT','KitKat',NULL,'KitKat- đn là mê','2026-03-19 14:03:25.455314'),(4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-03-19 14:04:02.978638',NULL,NULL,'https://res.cloudinary.com/didvvefmu/image/upload/v1773929027/smalltrend/crm/ads/dhabu2yyxvfnse54t4ds.jpg',0,NULL,NULL,NULL,'RIGHT','HuyHandSome',NULL,'HotDog-Bữa sáng tốt lành cho mọi người','2026-03-19 14:04:02.978638');
INSERT INTO `advertisements` (id,slot,sponsor_name,title,subtitle,image_url,link_url,cta_text,cta_color,bg_color,is_active,created_at,updated_at) VALUES (1,'LEFT','SmallTrend Brand','Mega Sale 50% OFF','Ưu đãi cuối tuần cho mọi sản phẩm','https://images.unsplash.com/photo-1607082348824-0a96f2a4b9da?w=400&q=80','','Mua ngay','#4f46e5','#ffffff',0,'2026-03-18 01:40:09.000000','2026-03-19 15:39:05.966119'),(2,'RIGHT','Express Delivery Partner','Giao hàng miễn phí','Đơn từ 200.000đ — giao trong 2h','https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?w=400&q=80','','Đặt ngay','#059669','#f0fdf4',0,'2026-03-18 01:40:09.000000','2026-03-19 14:04:19.055381'),(3,'LEFT','KitKat','KitKat- đn là mê',NULL,'https://res.cloudinary.com/didvvefmu/image/upload/v1773928997/smalltrend/crm/ads/ymypqgpfxq3wvajk8ycq.jpg',NULL,NULL,NULL,NULL,0,'2026-03-19 14:03:25.455314','2026-03-19 14:03:25.455314'),(4,'RIGHT','HuyHandSome','HotDog-Bữa sáng tốt lành cho mọi người',NULL,'https://res.cloudinary.com/didvvefmu/image/upload/v1773929027/smalltrend/crm/ads/dhabu2yyxvfnse54t4ds.jpg',NULL,NULL,NULL,NULL,0,'2026-03-19 14:04:02.978638','2026-03-19 14:04:02.978638');
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For advertisements.link_url, the first two rows use an empty string ('') while later rows use NULL. Empty string vs NULL often produces different behavior (e.g., UI treating '' as a present link and rendering a broken anchor). Prefer using NULL consistently when no link is intended (or provide an actual URL) to avoid downstream conditional bugs.

Suggested change
INSERT INTO `advertisements` (id,slot,sponsor_name,title,subtitle,image_url,link_url,cta_text,cta_color,bg_color,is_active,created_at,updated_at) VALUES (1,'LEFT','SmallTrend Brand','Mega Sale 50% OFF','Ưu đãi cuối tuần cho mọi sản phẩm','https://images.unsplash.com/photo-1607082348824-0a96f2a4b9da?w=400&q=80','','Mua ngay','#4f46e5','#ffffff',0,'2026-03-18 01:40:09.000000','2026-03-19 15:39:05.966119'),(2,'RIGHT','Express Delivery Partner','Giao hàng miễn phí','Đơn từ 200.000đ — giao trong 2h','https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?w=400&q=80','','Đặt ngay','#059669','#f0fdf4',0,'2026-03-18 01:40:09.000000','2026-03-19 14:04:19.055381'),(3,'LEFT','KitKat','KitKat- đn là mê',NULL,'https://res.cloudinary.com/didvvefmu/image/upload/v1773928997/smalltrend/crm/ads/ymypqgpfxq3wvajk8ycq.jpg',NULL,NULL,NULL,NULL,0,'2026-03-19 14:03:25.455314','2026-03-19 14:03:25.455314'),(4,'RIGHT','HuyHandSome','HotDog-Bữa sáng tốt lành cho mọi người',NULL,'https://res.cloudinary.com/didvvefmu/image/upload/v1773929027/smalltrend/crm/ads/dhabu2yyxvfnse54t4ds.jpg',NULL,NULL,NULL,NULL,0,'2026-03-19 14:04:02.978638','2026-03-19 14:04:02.978638');
INSERT INTO `advertisements` (id,slot,sponsor_name,title,subtitle,image_url,link_url,cta_text,cta_color,bg_color,is_active,created_at,updated_at) VALUES (1,'LEFT','SmallTrend Brand','Mega Sale 50% OFF','Ưu đãi cuối tuần cho mọi sản phẩm','https://images.unsplash.com/photo-1607082348824-0a96f2a4b9da?w=400&q=80',NULL,'Mua ngay','#4f46e5','#ffffff',0,'2026-03-18 01:40:09.000000','2026-03-19 15:39:05.966119'),(2,'RIGHT','Express Delivery Partner','Giao hàng miễn phí','Đơn từ 200.000đ — giao trong 2h','https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?w=400&q=80',NULL,'Đặt ngay','#059669','#f0fdf4',0,'2026-03-18 01:40:09.000000','2026-03-19 14:04:19.055381'),(3,'LEFT','KitKat','KitKat- đn là mê',NULL,'https://res.cloudinary.com/didvvefmu/image/upload/v1773928997/smalltrend/crm/ads/ymypqgpfxq3wvajk8ycq.jpg',NULL,NULL,NULL,NULL,0,'2026-03-19 14:03:25.455314','2026-03-19 14:03:25.455314'),(4,'RIGHT','HuyHandSome','HotDog-Bữa sáng tốt lành cho mọi người',NULL,'https://res.cloudinary.com/didvvefmu/image/upload/v1773929027/smalltrend/crm/ads/dhabu2yyxvfnse54t4ds.jpg',NULL,NULL,NULL,NULL,0,'2026-03-19 14:04:02.978638','2026-03-19 14:04:02.978638');

Copilot uses AI. Check for mistakes.
-- ADVERTISEMENTS & AD CONTRACTS
-- =============================================================================
INSERT INTO `advertisements` VALUES (1,'#ffffff','marketing@smalltrend.vn','Nguyễn Văn Marketing','0901-234-567','2026-12-31','AD-2026-LEFT-001','2026-01-01',5000000.00,'2026-03-18 01:40:09.000000','#4f46e5','Mua ngay','https://images.unsplash.com/photo-1607082348824-0a96f2a4b9da?w=400&q=80',0,'','Hợp đồng quảng cáo nội bộ, ưu tiên slot trái toàn năm 2026','Thanh toán hàng quý, net 30 ngày','LEFT','SmallTrend Brand','Ưu đãi cuối tuần cho mọi sản phẩm','Mega Sale 50% OFF','2026-03-19 15:39:05.966119'),(2,'#f0fdf4','ads@expressdelivery.vn','Trần Thị Logistics','0912-345-678','2026-06-30','AD-2026-RIGHT-001','2026-01-01',12000000.00,'2026-03-18 01:40:09.000000','#059669','Đặt ngay','https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?w=400&q=80',0,'','Đối tác giao hàng nhanh khu vực HCM & Hà Nội. Hợp đồng gia hạn mỗi 6 tháng.','Thanh toán hàng tháng vào ngày 15','RIGHT','Express Delivery Partner','Đơn từ 200.000đ — giao trong 2h','Giao hàng miễn phí','2026-03-19 14:04:19.055381'),(3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-03-19 14:03:25.455314',NULL,NULL,'https://res.cloudinary.com/didvvefmu/image/upload/v1773928997/smalltrend/crm/ads/ymypqgpfxq3wvajk8ycq.jpg',0,NULL,NULL,NULL,'LEFT','KitKat',NULL,'KitKat- đn là mê','2026-03-19 14:03:25.455314'),(4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-03-19 14:04:02.978638',NULL,NULL,'https://res.cloudinary.com/didvvefmu/image/upload/v1773929027/smalltrend/crm/ads/dhabu2yyxvfnse54t4ds.jpg',0,NULL,NULL,NULL,'RIGHT','HuyHandSome',NULL,'HotDog-Bữa sáng tốt lành cho mọi người','2026-03-19 14:04:02.978638');
INSERT INTO `advertisements` (id,slot,sponsor_name,title,subtitle,image_url,link_url,cta_text,cta_color,bg_color,is_active,created_at,updated_at) VALUES (1,'LEFT','SmallTrend Brand','Mega Sale 50% OFF','Ưu đãi cuối tuần cho mọi sản phẩm','https://images.unsplash.com/photo-1607082348824-0a96f2a4b9da?w=400&q=80','','Mua ngay','#4f46e5','#ffffff',0,'2026-03-18 01:40:09.000000','2026-03-19 15:39:05.966119'),(2,'RIGHT','Express Delivery Partner','Giao hàng miễn phí','Đơn từ 200.000đ — giao trong 2h','https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?w=400&q=80','','Đặt ngay','#059669','#f0fdf4',0,'2026-03-18 01:40:09.000000','2026-03-19 14:04:19.055381'),(3,'LEFT','KitKat','KitKat- đn là mê',NULL,'https://res.cloudinary.com/didvvefmu/image/upload/v1773928997/smalltrend/crm/ads/ymypqgpfxq3wvajk8ycq.jpg',NULL,NULL,NULL,NULL,0,'2026-03-19 14:03:25.455314','2026-03-19 14:03:25.455314'),(4,'RIGHT','HuyHandSome','HotDog-Bữa sáng tốt lành cho mọi người',NULL,'https://res.cloudinary.com/didvvefmu/image/upload/v1773929027/smalltrend/crm/ads/dhabu2yyxvfnse54t4ds.jpg',NULL,NULL,NULL,NULL,0,'2026-03-19 14:04:02.978638','2026-03-19 14:04:02.978638');
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as deploy/fix_seed.sql: link_url is set to '' for the first two rows and NULL for others. Standardize on NULL for ‘no link’ to prevent consumers from treating empty string as a valid URL and rendering broken links.

Suggested change
INSERT INTO `advertisements` (id,slot,sponsor_name,title,subtitle,image_url,link_url,cta_text,cta_color,bg_color,is_active,created_at,updated_at) VALUES (1,'LEFT','SmallTrend Brand','Mega Sale 50% OFF','Ưu đãi cuối tuần cho mọi sản phẩm','https://images.unsplash.com/photo-1607082348824-0a96f2a4b9da?w=400&q=80','','Mua ngay','#4f46e5','#ffffff',0,'2026-03-18 01:40:09.000000','2026-03-19 15:39:05.966119'),(2,'RIGHT','Express Delivery Partner','Giao hàng miễn phí','Đơn từ 200.000đ — giao trong 2h','https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?w=400&q=80','','Đặt ngay','#059669','#f0fdf4',0,'2026-03-18 01:40:09.000000','2026-03-19 14:04:19.055381'),(3,'LEFT','KitKat','KitKat- đn là mê',NULL,'https://res.cloudinary.com/didvvefmu/image/upload/v1773928997/smalltrend/crm/ads/ymypqgpfxq3wvajk8ycq.jpg',NULL,NULL,NULL,NULL,0,'2026-03-19 14:03:25.455314','2026-03-19 14:03:25.455314'),(4,'RIGHT','HuyHandSome','HotDog-Bữa sáng tốt lành cho mọi người',NULL,'https://res.cloudinary.com/didvvefmu/image/upload/v1773929027/smalltrend/crm/ads/dhabu2yyxvfnse54t4ds.jpg',NULL,NULL,NULL,NULL,0,'2026-03-19 14:04:02.978638','2026-03-19 14:04:02.978638');
INSERT INTO `advertisements` (id,slot,sponsor_name,title,subtitle,image_url,link_url,cta_text,cta_color,bg_color,is_active,created_at,updated_at) VALUES (1,'LEFT','SmallTrend Brand','Mega Sale 50% OFF','Ưu đãi cuối tuần cho mọi sản phẩm','https://images.unsplash.com/photo-1607082348824-0a96f2a4b9da?w=400&q=80',NULL,'Mua ngay','#4f46e5','#ffffff',0,'2026-03-18 01:40:09.000000','2026-03-19 15:39:05.966119'),(2,'RIGHT','Express Delivery Partner','Giao hàng miễn phí','Đơn từ 200.000đ — giao trong 2h','https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?w=400&q=80',NULL,'Đặt ngay','#059669','#f0fdf4',0,'2026-03-18 01:40:09.000000','2026-03-19 14:04:19.055381'),(3,'LEFT','KitKat','KitKat- đn là mê',NULL,'https://res.cloudinary.com/didvvefmu/image/upload/v1773928997/smalltrend/crm/ads/ymypqgpfxq3wvajk8ycq.jpg',NULL,NULL,NULL,NULL,0,'2026-03-19 14:03:25.455314','2026-03-19 14:03:25.455314'),(4,'RIGHT','HuyHandSome','HotDog-Bữa sáng tốt lành cho mọi người',NULL,'https://res.cloudinary.com/didvvefmu/image/upload/v1773929027/smalltrend/crm/ads/dhabu2yyxvfnse54t4ds.jpg',NULL,NULL,NULL,NULL,0,'2026-03-19 14:04:02.978638','2026-03-19 14:04:02.978638');

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants