Enhanced SCSS integration with Odoo 14 variables and components

This commit is contained in:
Mohamed Eltayar 2025-08-28 16:44:44 +03:00
parent 9661e5caa8
commit 1f759b0aa0
1 changed files with 372 additions and 38 deletions

View File

@ -1,66 +1,400 @@
/*
* Web Hijri Datepicker SCSS - Odoo 14 Integration
* Enhanced to work seamlessly with Odoo's standard datepicker system
* Maintains all Hijri functionality while matching Odoo's exact appearance
*/
// Import Odoo variables and mixins for consistency
@import url('/web/static/src/scss/primary_variables.scss');
/* ==================== HIJRI DATEPICKER INTEGRATION ==================== */
// Popup positioning and z-index - exactly matching Odoo's datepicker
.calendars-popup {
z-index: 99999 !important;
z-index: $zindex-modal + 1 !important; // Same as Odoo's datepicker (1051)
position: absolute !important;
& > .calendars {
min-width: 225px;
& > .calendars-month-row {
& > .calendars-month {
// Main calendar container
> .calendars {
width: 22rem; // Same as Odoo's datepicker (352px)
min-width: 22rem;
// Month row container
> .calendars-month-row {
> .calendars-month {
width: 100%;
& > .calendars-month-header {
display: flex;
& > .calendars-month-year {
width: auto;
display: inline;
// Month header styling to match Odoo
> .calendars-month-header {
display: flex !important;
justify-content: space-between;
align-items: center;
background-color: $white;
border-bottom: 1px solid $border-color;
padding: 0.5rem 0.75rem;
> .calendars-month-year {
flex: 1;
text-align: center;
font-size: 1.25rem;
font-weight: 500;
color: $body-color;
margin: 0;
padding: 0;
}
// Navigation buttons
.calendars-nav {
width: 2.5rem;
height: 2.5rem;
display: inline-flex;
align-items: center;
justify-content: center;
background: transparent;
border: none;
color: $text-muted;
border-radius: $border-radius;
transition: $transition-base;
cursor: pointer;
&:hover,
&:focus {
background-color: $gray-200;
color: $body-color;
outline: 0;
}
}
}
}
}
// Calendar table styling
.calendars-month {
table {
& > thead {
& > tr {
& > th {
width: 100%;
margin-bottom: 0;
border-collapse: collapse;
> thead {
background-color: $white;
border-bottom: 2px solid $border-color;
> tr {
> th {
padding: 0.5rem;
font-weight: 500;
color: $text-muted;
font-size: $font-size-sm;
text-align: center;
border: none;
vertical-align: bottom;
border-bottom: 1px solid $border-color;
span {
max-width: 29px;
display: block;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
}
> tbody {
> tr {
> td {
position: relative;
padding: 0;
border: none;
text-align: center;
vertical-align: middle;
a, span {
display: block;
width: 2.5rem;
height: 2.5rem;
line-height: 2.5rem;
text-align: center;
text-decoration: none;
color: $body-color;
border-radius: $border-radius;
margin: 0.125rem auto;
transition: $transition-base;
font-weight: 400;
font-size: $font-size-sm;
border: 1px solid transparent;
}
a {
cursor: pointer;
&:hover {
background-color: $gray-200;
color: $body-color;
text-decoration: none;
}
}
}
}
}
}
}
}
}
.o_list_view .o_data_row.o_selected_row {
& > .o_data_cell:not(.o_readonly_modifier) {
& > .o_datepicker {
position: relative;
display: inline;
float: left;
width: 50%;
}
}
}
/* ==================== ODOO FORM INTEGRATION ==================== */
// List view integration
.o_list_view {
.o_list_table {
tbody {
tr {
td {
.o_datepicker_input {
width: 50% !important;
.o_data_row.o_selected_row {
> .o_data_cell:not(.o_readonly_modifier) {
> .o_datepicker {
position: relative;
display: flex;
flex-direction: column;
width: 100%;
// Gregorian date input
.o_datepicker_input {
width: 100%;
margin-bottom: 0.25rem;
}
// Hijri date input
.o_hijri {
width: 100%;
font-size: $font-size-sm;
color: $success;
background-color: $light;
border-color: $border-color;
&::placeholder {
color: $text-muted;
font-style: italic;
}
}
}
}
}
}
.o_datepicker {
.o_datepicker_button {
&.o_hijri_datepicker_button {
top: 30px;
}
// Table styling adjustments
.o_list_table {
tbody {
tr {
td {
.o_datepicker {
min-width: 200px; // Ensure adequate space for both dates
.o_datepicker_input,
.o_hijri {
width: 100% !important;
}
}
}
}
}
}
}
/* ==================== FORM VIEW INTEGRATION ==================== */
.o_form_view {
.o_datepicker {
.o_hijri {
margin-top: 0.5rem;
font-size: $font-size-sm;
color: $success;
background-color: rgba($success, 0.1);
border: 1px solid rgba($success, 0.2);
&:focus {
border-color: $success;
box-shadow: 0 0 0 0.2rem rgba($success, 0.25);
}
&.o_input_placeholder {
color: $text-muted;
font-style: italic;
}
}
// Datepicker buttons positioning
.o_datepicker_button {
&.o_hijri_datepicker_button {
top: calc(100% + 0.5rem + 2px); // Position below the Hijri input
right: 0.75rem;
color: $success;
&:hover {
color: darken($success, 15%);
}
}
}
}
}
/* ==================== READONLY VIEW STYLING ==================== */
.o_gregorian_date {
color: $body-color;
font-weight: 500;
}
.o_hijri_date {
margin-top: 0.25rem !important;
font-size: $font-size-sm !important;
color: $success !important;
font-weight: 500 !important;
span {
color: $text-muted !important;
font-weight: 400 !important;
}
}
/* ==================== RESPONSIVE DESIGN ==================== */
// Mobile and tablet adjustments
@media (max-width: 768px) {
.calendars-popup {
> .calendars {
width: calc(100vw - 2rem);
min-width: 20rem;
max-width: 22rem;
}
}
.o_list_view .o_datepicker {
.o_datepicker_input,
.o_hijri {
font-size: $font-size-sm;
}
}
}
@media (max-width: 576px) {
.o_form_view .o_datepicker .o_hijri {
margin-top: 0.375rem;
font-size: 0.75rem;
}
.o_hijri_date {
font-size: 0.75rem !important;
}
}
/* ==================== SPECIAL HIJRI FEATURES ==================== */
// Arabic text enhancement
.calendars {
&.arabic-numbers {
font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
td a, td span {
font-family: inherit;
direction: ltr;
unicode-bidi: embed;
}
}
// RTL support for Arabic interface
&.calendars-rtl {
direction: rtl;
.calendars-month-header {
.calendars-nav {
&.calendars-prev:before {
content: "\f054";
}
&.calendars-next:before {
content: "\f053";
}
}
}
}
}
// Hijri-specific calendar classes
.calendars-selected a {
background-color: $primary !important;
border-color: $primary !important;
color: $white !important;
&:hover {
background-color: darken($primary, 10%) !important;
border-color: darken($primary, 12.5%) !important;
}
}
.calendars-today a {
background-color: $white;
color: $primary;
border-color: $primary;
font-weight: 500;
position: relative;
&:after {
content: "";
position: absolute;
bottom: 0.25rem;
left: 50%;
transform: translateX(-50%);
width: 0.25rem;
height: 0.25rem;
background-color: $primary;
border-radius: 50%;
}
&:hover {
background-color: $primary;
color: $white;
&:after {
background-color: $white;
}
}
}
/* ==================== ACCESSIBILITY ENHANCEMENTS ==================== */
.calendars {
// Focus indicators
td a:focus {
outline: 0;
box-shadow: 0 0 0 0.2rem rgba($primary, 0.25);
z-index: 2;
}
// Screen reader support
.sr-only {
position: absolute !important;
width: 1px !important;
height: 1px !important;
padding: 0 !important;
margin: -1px !important;
overflow: hidden !important;
clip: rect(0, 0, 0, 0) !important;
white-space: nowrap !important;
border: 0 !important;
}
}
/* ==================== ANIMATION REFINEMENTS ==================== */
// Subtle entrance animation matching Odoo's style
@keyframes odooFadeInUp {
from {
opacity: 0;
transform: translateY(0.5rem);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.calendars-popup {
animation: odooFadeInUp 0.15s ease-out;
}