Update Hijri datepicker CSS to match Odoo 14 standard datepicker styling

This commit is contained in:
Mohamed Eltayar 2025-08-28 16:43:50 +03:00
parent 36adb21b0e
commit 9661e5caa8
1 changed files with 302 additions and 149 deletions

View File

@ -1,192 +1,308 @@
/*
* Modern Hijri Datepicker CSS
* Designed to integrate seamlessly with Odoo's UI
* Version: 2.2.0 Compatible
* Enhanced Hijri Datepicker CSS - Odoo 14 Compatible
* Designed to perfectly match Odoo's standard datepicker appearance
* Based on Tempus Dominus Bootstrap 4 styling with Hijri functionality
* Version: 2.2.0 - Odoo 14 Standard Compatible
*/
/* ==================== MODERN HIJRI DATEPICKER ==================== */
/* ==================== ODOO 14 COMPATIBLE HIJRI DATEPICKER ==================== */
/* Main popup container - matching Odoo's exact z-index and positioning */
.calendars-popup {
z-index: 10000 !important;
z-index: 1051 !important; /* Same as Odoo standard datepicker */
position: absolute !important;
border: 1px solid #e0e0e0;
border-radius: 8px;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
border: 1px solid #ced4da;
border-radius: 0.25rem;
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
background: #ffffff;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
font-size: 13px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
font-size: 0.875rem;
line-height: 1.5;
color: #212529;
overflow: hidden;
min-width: 22rem; /* Same as Odoo standard - 352px */
}
/* Main calendar container */
/* Calendar container - matching Bootstrap 4 structure */
.calendars {
min-width: 280px;
width: 22rem; /* Exact same width as Odoo datepicker */
padding: 0;
background: #ffffff;
border-radius: 8px;
border-radius: 0.25rem;
}
/* Calendar header */
/* Calendar header - exactly matching Odoo's datepicker header */
.calendars-month-header {
background: linear-gradient(135deg, #6c5ce7, #74b9ff);
color: white;
padding: 12px 16px;
background-color: #ffffff;
border-bottom: 1px solid #e9ecef;
padding: 0.5rem 0.75rem;
display: flex !important;
justify-content: space-between;
align-items: center;
font-weight: 600;
font-size: 14px;
font-weight: 500;
font-size: 1.25rem;
color: #495057;
}
.calendars-month-header .calendars-month-year {
font-size: 16px;
font-weight: 700;
font-size: 1.25rem;
font-weight: 500;
flex: 1;
text-align: center;
color: white;
color: #495057;
margin: 0;
padding: 0;
}
/* Navigation buttons */
/* Navigation buttons - exactly matching Odoo's style */
.calendars-nav {
background: transparent;
border: none;
color: white;
padding: 8px 12px;
border-radius: 6px;
color: #6c757d;
padding: 0.375rem 0.5rem;
border-radius: 0.25rem;
cursor: pointer;
font-size: 16px;
transition: all 0.2s ease;
margin: 0 4px;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out;
width: 2.5rem;
height: 2.5rem;
display: inline-flex;
align-items: center;
justify-content: center;
}
.calendars-nav:hover {
background: rgba(255, 255, 255, 0.2);
transform: scale(1.1);
.calendars-nav:hover,
.calendars-nav:focus {
color: #495057;
background-color: #e9ecef;
outline: 0;
}
.calendars-nav:before {
font-family: "Font Awesome 5 Free";
font-weight: 900;
font-size: 0.875rem;
}
.calendars-prev:before {
content: "\f053"; /* fa-chevron-left */
}
.calendars-next:before {
content: "\f054"; /* fa-chevron-right */
}
/* Week header - matching Odoo's table styling */
.calendars table {
width: 100%;
margin-bottom: 0;
border-collapse: collapse;
background-color: transparent;
}
/* Week header */
.calendars thead {
background: #f8f9fa;
border-bottom: 1px solid #e9ecef;
background-color: #ffffff;
border-bottom: 2px solid #dee2e6;
}
.calendars thead th {
padding: 12px 8px;
font-weight: 600;
padding: 0.5rem;
font-weight: 500;
color: #6c757d;
font-size: 12px;
font-size: 0.875rem;
text-align: center;
text-transform: uppercase;
letter-spacing: 0.5px;
border: none;
vertical-align: bottom;
border-bottom: 1px solid #dee2e6;
}
/* Calendar days */
/* Calendar body */
.calendars tbody {
background-color: #ffffff;
}
/* Calendar days - exactly matching Odoo's day styling */
.calendars td {
position: relative;
padding: 0;
border: none;
background: white;
background: #ffffff;
text-align: center;
vertical-align: middle;
}
.calendars td a,
.calendars td span {
display: block;
width: 36px;
height: 36px;
line-height: 36px;
width: 2.5rem;
height: 2.5rem;
line-height: 2.5rem;
text-align: center;
text-decoration: none;
color: #495057;
border-radius: 6px;
margin: 2px;
transition: all 0.2s ease;
font-weight: 500;
border-radius: 0.25rem;
margin: 0.125rem auto;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out;
font-weight: 400;
font-size: 0.875rem;
position: relative;
border: 1px solid transparent;
}
/* Selectable dates */
/* Hoverable dates - matching Odoo's hover effect */
.calendars td a {
cursor: pointer;
}
.calendars td a:hover {
background: #e3f2fd;
color: #1976d2;
transform: scale(1.05);
box-shadow: 0 2px 8px rgba(25, 118, 210, 0.2);
background-color: #e9ecef;
color: #495057;
text-decoration: none;
}
/* Selected date */
/* Selected date - exactly matching Odoo's selected styling */
.calendars .calendars-selected a {
background: linear-gradient(135deg, #4caf50, #66bb6a) !important;
color: white !important;
font-weight: 700;
box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
background-color: #007bff !important;
border-color: #007bff !important;
color: #ffffff !important;
font-weight: 500;
}
/* Today */
.calendars .calendars-selected a:hover {
background-color: #0056b3 !important;
border-color: #004085 !important;
color: #ffffff !important;
}
/* Today - matching Odoo's today styling */
.calendars .calendars-today a {
background: #fff3e0;
color: #f57c00;
border: 2px solid #ff9800;
font-weight: 600;
background-color: #ffffff;
color: #007bff;
border-color: #007bff;
font-weight: 500;
position: relative;
}
.calendars .calendars-today a:after {
content: "";
position: absolute;
bottom: 0.25rem;
left: 50%;
transform: translateX(-50%);
width: 0.25rem;
height: 0.25rem;
background-color: #007bff;
border-radius: 50%;
}
.calendars .calendars-today a:hover {
background: #ff9800;
color: white;
background-color: #007bff;
color: #ffffff;
border-color: #007bff;
}
.calendars .calendars-today a:hover:after {
background-color: #ffffff;
}
/* Weekend days */
.calendars .calendars-weekend a {
color: #f44336;
font-weight: 600;
color: #6c757d;
}
/* Other month dates */
/* Other month dates - matching Odoo's muted styling */
.calendars .calendars-other-month span {
color: #bdbdbd;
font-weight: 400;
}
/* Disabled dates */
.calendars .calendars-disabled span {
color: #e0e0e0 !important;
cursor: not-allowed;
color: #6c757d;
opacity: 0.5;
}
/* Control buttons footer */
.calendars-commands {
background: #f8f9fa;
.calendars .calendars-other-month a {
color: #6c757d;
opacity: 0.5;
}
/* Disabled dates */
.calendars .calendars-disabled span,
.calendars .calendars-disabled a {
color: #6c757d !important;
opacity: 0.25 !important;
cursor: not-allowed !important;
pointer-events: none;
}
/* Time picker section if needed */
.calendars-time {
border-top: 1px solid #e9ecef;
padding: 12px 16px;
padding: 0.5rem 0.75rem;
background-color: #f8f9fa;
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
}
/* Control buttons - matching Odoo's button styling */
.calendars-commands {
background-color: #ffffff;
border-top: 1px solid #e9ecef;
padding: 0.5rem 0.75rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.calendars-cmd {
background: #ffffff;
border: 1px solid #dee2e6;
background-color: #ffffff;
border: 1px solid #ced4da;
color: #495057;
padding: 6px 12px;
border-radius: 4px;
font-size: 12px;
padding: 0.375rem 0.75rem;
border-radius: 0.25rem;
font-size: 0.875rem;
font-weight: 400;
line-height: 1.5;
cursor: pointer;
transition: all 0.2s ease;
font-weight: 500;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}
.calendars-cmd:hover {
background: #007bff;
color: white;
border-color: #007bff;
transform: translateY(-1px);
box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
color: #495057;
background-color: #e9ecef;
border-color: #adb5bd;
}
/* RTL Support */
.calendars-cmd:focus {
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
/* Today button specific styling */
.calendars-cmd-today {
background-color: #007bff;
border-color: #007bff;
color: #ffffff;
}
.calendars-cmd-today:hover {
background-color: #0056b3;
border-color: #004085;
color: #ffffff;
}
/* Clear button specific styling */
.calendars-cmd-clear {
color: #dc3545;
border-color: #dc3545;
}
.calendars-cmd-clear:hover {
background-color: #dc3545;
border-color: #dc3545;
color: #ffffff;
}
/* RTL Support - maintaining Arabic support */
.calendars.calendars-rtl {
direction: rtl;
}
@ -195,71 +311,108 @@
flex-direction: row-reverse;
}
/* Responsive design */
@media (max-width: 480px) {
.calendars {
min-width: 260px;
}
.calendars td a,
.calendars td span {
width: 32px;
height: 32px;
line-height: 32px;
font-size: 12px;
}
.calendars-month-header {
padding: 10px 12px;
font-size: 13px;
}
.calendars.calendars-rtl .calendars-prev:before {
content: "\f054"; /* Swap arrow direction for RTL */
}
/* Animation for popup appearance */
@keyframes hijriSlideIn {
from {
opacity: 0;
transform: translateY(-10px) scale(0.95);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
.calendars-popup {
animation: hijriSlideIn 0.2s ease-out;
}
/* Special styling for Arabic numbers */
.calendars.arabic-numbers {
font-family: 'Arial Unicode MS', 'Tahoma', sans-serif;
}
/* Status bar styling if enabled */
.calendars-status {
background: #343a40;
color: white;
padding: 8px 12px;
font-size: 11px;
text-align: center;
border-top: 1px solid #495057;
.calendars.calendars-rtl .calendars-next:before {
content: "\f053"; /* Swap arrow direction for RTL */
}
/* Multiple month display */
.calendars-multi .calendars-month {
display: inline-block;
vertical-align: top;
margin: 0 4px;
margin: 0 0.25rem;
width: calc(50% - 0.5rem);
}
/* Clear button special styling */
.calendars-cmd.calendars-clear {
color: #dc3545;
border-color: #dc3545;
.calendars-multi {
width: auto;
min-width: 44rem; /* Double width for multiple months */
}
.calendars-cmd.calendars-clear:hover {
background: #dc3545;
color: white;
/* Animation for popup appearance - subtle like Odoo */
@keyframes odooFadeIn {
from {
opacity: 0;
transform: translateY(-0.25rem);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.calendars-popup {
animation: odooFadeIn 0.15s ease-out;
}
/* Responsive adjustments */
@media (max-width: 576px) {
.calendars-popup {
min-width: 20rem;
max-width: calc(100vw - 2rem);
}
.calendars {
width: 100%;
}
.calendars-multi {
min-width: auto;
}
.calendars-multi .calendars-month {
width: 100%;
margin: 0.5rem 0;
display: block;
}
}
/* Special handling for Arabic numerals - preserving Hijri functionality */
.calendars.arabic-numbers {
font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
}
.calendars.arabic-numbers td a,
.calendars.arabic-numbers td span {
font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
direction: ltr; /* Numbers should always be LTR */
}
/* Hijri-specific enhancements while maintaining Odoo look */
.hijri-modern-popup {
/* Additional class for Hijri-specific styling if needed */
}
.hijri-modern-popup .calendars-month-header .calendars-month-year {
/* Enhanced Arabic text rendering */
font-feature-settings: "liga" 1, "calt" 1;
text-rendering: optimizeLegibility;
}
/* Status bar for Hijri information */
.calendars-status {
background-color: #f8f9fa;
color: #6c757d;
padding: 0.5rem 0.75rem;
font-size: 0.75rem;
text-align: center;
border-top: 1px solid #e9ecef;
font-style: italic;
}
/* Integration fixes for Odoo's existing classes */
.bootstrap-datetimepicker-widget.calendars-popup {
/* Ensure compatibility with existing Odoo CSS selectors */
z-index: 1051 !important;
}
/* Ensure proper positioning relative to Odoo's input fields */
.o_datepicker .calendars-popup {
position: absolute;
top: 100%;
left: 0;
margin-top: 0.125rem;
}