add cenhomes addons

This commit is contained in:
2025-03-04 16:53:07 +07:00
parent 081505ce33
commit 4b8cd12232
144 changed files with 19868 additions and 0 deletions
@@ -0,0 +1,65 @@
/** @odoo-module **/
import {_lt} from "@web/core/l10n/translation";
import {registry} from "@web/core/registry";
import {listView} from "@web/views/list/list_view";
import {ListRenderer} from "@web/views/list/list_renderer";
import {ListController} from "@web/views/list/list_controller";
import {Component, useState} from "@odoo/owl";
import { useService } from "@web/core/utils/hooks";
export class CenhomesComponent extends Component {
setup() {
this.action = useService("action");
}
async copyLinkForm() {
const session = require("web.session");
const phong_thu_tuc = await session.user_has_group('cenhomes_student.group_cenhomes_phong_thu_tuc')
let urlForm = window.location.origin + '/cenhomes/hoc_vien_phong_thu_tuc/';
if (!phong_thu_tuc) {
urlForm += btoa(session.uid);
} else {
urlForm += 'default';
}
await navigator.clipboard.writeText(urlForm);
try {
const result = await this.action.doAction({
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'message': `Đã copy link mời`,
'type': 'success',
'sticky': false
},
});
console.log('Action result:', result);
} catch (error) {
console.error('Error:', error);
}
}
}
CenhomesComponent.components = {};
CenhomesComponent.template = "cenhomes.CenhomesComponent";
export class CenhomesListController extends ListController {
}
CenhomesListController.components = {
...ListController.components,
CenhomesComponent
};
registry.category("view_widgets").add("cenhomes_component", CenhomesComponent);
export const CenhomesListView = {
...listView,
Controller: CenhomesListController,
Renderer: ListRenderer,
buttonTemplate: "cenhomes.ListView.Buttons",
};
registry.category("views").add("cenhomes_tree", CenhomesListView);
@@ -0,0 +1,27 @@
.o_drop_area {
width: 100%;
height: 100%;
position: absolute;
background-color: #AAAA;
z-index: 2;
left: 0;
top: 0;
i {
justify-content: center;
display: flex;
align-items: center;
height: 100%;
}
}
.file_upload_kanban_action_a {
@include o-kanban-dashboard-dropdown-link($link-padding-gap: $o-kanban-dashboard-dropdown-complex-gap);
}
.o_widget_account_file_uploader {
.btn-primary.oe_kanban_action_button {
a {
color: $white;
}
}
}
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="cenhomes.CenhomesComponent" owl="1">
<button t-on-click="copyLinkForm"
class="btn btn-primary o_list_button_add"
style="margin-left: 20px">
LINK FORM
</button>
</t>
<t t-name="cenhomes.ListView.Buttons" t-inherit="web.ListView.Buttons" t-inherit-mode="primary" owl="1">
<xpath expr="//*[@class='btn btn-primary o_list_button_add']" position="after">
<CenhomesComponent/>
</xpath>
</t>
</templates>
@@ -0,0 +1,40 @@
/** @odoo-module **/
import {registry} from "@web/core/registry";
import {ControlPanel} from "@web/search/control_panel/control_panel";
import {useService} from "@web/core/utils/hooks";
import {listView} from "@web/views/list/list_view";
import {ListController} from "@web/views/list/list_controller";
export class DanhMucNguyenVongListControlPanel extends ControlPanel {
setup() {
super.setup();
}
}
DanhMucNguyenVongListControlPanel.template = "cenhomes.DanhMucNguyenVongControlPanel";
export class DanhMucNguyenVongListController extends ListController {
async setup() {
super.setup(...arguments);
this.orm = useService("orm");
const nhomNganh = await this.orm.call("cenhomes.nhom_nganh", "search_read", [], {
fields: ["ten_nhom_nganh"],
domain: [
["menu", "=", this.props.context['sort_nganh_nghe_muon_hoc']]
],
});
if (typeof nhomNganh !== 'undefined' && nhomNganh.length > 0) {
this.env.config.setDisplayName(this.env.config.getDisplayName() + " " + this.env._t(nhomNganh[0]['ten_nhom_nganh']));
}
}
}
export const danhMucNguyenVongListView = {
...listView,
Controller: DanhMucNguyenVongListController,
ControlPanel: DanhMucNguyenVongListControlPanel,
};
registry.category("views").add("danhMucNguyenVong_listView", danhMucNguyenVongListView);
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="cenhomes.DanhMucNguyenVongControlPanelContentBadge" owl="1">
</t>
<t t-name="cenhomes.DanhMucNguyenVongControlPanelContent" owl="1">
<t>
<li class="o_project_updates_breadcrumb ps-3">
<t t-call="cenhomes.DanhMucNguyenVongControlPanelContentBadge" />
</li>
</t>
</t>
<t t-name="cenhomes.Breadcrumbs" t-inherit="web.Breadcrumbs" t-inherit-mode="primary" owl="1">
<xpath expr="//ol" position="inside">
<t t-call="cenhomes.DanhMucNguyenVongControlPanelContent"/>
</xpath>
</t>
<t t-name="cenhomes.Breadcrumbs.Small" t-inherit="web.Breadcrumbs.Small" t-inherit-mode="primary" owl="1">
<xpath expr="//ol" position="inside">
<t t-call="cenhomes.DanhMucNguyenVongControlPanelContent"/>
</xpath>
</t>
<t t-name="cenhomes.DanhMucNguyenVongControlPanel.Regular" t-inherit="web.ControlPanel.Regular" t-inherit-mode="primary" owl="1">
<xpath expr="//t[@t-call='web.Breadcrumbs']" position="replace">
<t t-call="cenhomes.Breadcrumbs"/>
</xpath>
</t>
<t t-name="cenhomes.DanhMucNguyenVongControlPanel.Small" t-inherit="web.ControlPanel.Small" t-inherit-mode="primary" owl="1">
<xpath expr="//t[@t-call='web.Breadcrumbs.Small']" position="replace">
<t t-call="cenhomes.Breadcrumbs.Small"/>
</xpath>
</t>
<t t-name="cenhomes.DanhMucNguyenVongControlPanel" t-inherit="web.ControlPanel" t-inherit-mode="primary" owl="1">
<xpath expr="//t[@t-call='web.ControlPanel.Regular']" position="replace">
<t t-call="cenhomes.DanhMucNguyenVongControlPanel.Regular"/>
</xpath>
<xpath expr="//t[@t-call='web.ControlPanel.Small']" position="replace">
<t t-call="cenhomes.DanhMucNguyenVongControlPanel.Small"/>
</xpath>
</t>
</templates>
@@ -0,0 +1,54 @@
.o_form_view .o_input {
padding: 2px 4px;
border-bottom: 1px solid #00000057 !important;
}
.danh_muc_nguyen_vong_nganh_tree [data-name="so_dien_thoai_lien_he"] {
width: 60px !important;
}
.danh_muc_nguyen_vong_nganh_tree [data-name="email"] {
width: 120px !important;
}
.o_auto_scroll {
overflow-x: auto !important;
white-space: nowrap !important;
}
.o_list_table thead .o_list_number_th {
text-align: left;
}
.text-truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: normal !important;
}
.o_list_view th {
min-width: 150px;
word-wrap: break-word !important; /* Ngắt dòng theo từ */
white-space: nowrap !important;
text-align: left !important; /* Căn giữa nội dung tiêu đề */
align-items: center;
}
/* Icon sort nằm bên phải */
.o_list_view th .o_column_sortable {
display: flex; /* Dùng flexbox để điều chỉnh vị trí */
justify-content: space-between; /* Tên cột bên trái, icon bên phải */
}
.o_list_view th .o_column_sortable {
display: flex; /* Dùng flexbox để điều chỉnh vị trí */
justify-content: space-between; /* Tên cột bên trái, icon bên phải */
align-items: center;
}
.o_list_view td {
min-width: 150px;
white-space: normal !important; /* Tự động xuống dòng trong các ô */
word-wrap: break-word !important;
text-align: left !important; /* Căn giữa nội dung tiêu đề */
}
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
/** @odoo-module **/
import { ListController } from "@web/views/list/list_controller";
export class DanhMucNguyenVongListController extends ListController {
setup() {
super.setup(...arguments);
this.display_name += " - Tasks by Deadline";
}
}
@@ -0,0 +1,13 @@
/** @odoo-module **/
import { registry } from "@web/core/registry";
import { listView } from "@web/views/list/list_view";
import { DanhMucNguyenVongListController } from "@cenhomes_student/views/danh_muc_nguyen_vong/danh_muc_nguyen_vong_nganh_controller";
import { DanhMucNguyenVongListControlPanel } from "@cenhomes_student/components/danh_muc_nguyen_vong/danh_muc_nguyen_vong_nganh_control_panel";
export const danhMucNguyenVongListView = {
...listView,
Controller: DanhMucNguyenVongListController,
ControlPanel: DanhMucNguyenVongListControlPanel,
};
registry.category("views").add("danh_muc_nguyen_vong_list_view", danhMucNguyenVongListView);