From 73e8b2f9125789df4491b1d6eb63367507f036a3 Mon Sep 17 00:00:00 2001 From: Baljit998 Date: Thu, 30 Nov 2023 13:42:24 +0530 Subject: [PATCH 1/2] Added some css --- .../notice_board/doctype/assignto/__init__.py | 0 .../doctype/assignto/assignto.json | 31 ++++++++ .../notice_board/doctype/assignto/assignto.py | 8 ++ .../notice_board/doctype/notice/notice.js | 2 + .../notice_board/doctype/notice/notice.json | 14 +++- .../notice_board/doctype/notice/notice.py | 3 + .../doctype/notice/notice_row.css | 32 ++++++++ .../doctype/notice/templates/notice_row.html | 78 +++++++++++++++---- noticeboard/www/notices.html | 48 ++++++++++++ noticeboard/www/notices.js | 2 + noticeboard/www/notices.py | 35 +++++++++ noticeboard/www/user.html | 7 ++ noticeboard/www/user.py | 4 + 13 files changed, 245 insertions(+), 19 deletions(-) create mode 100644 noticeboard/notice_board/doctype/assignto/__init__.py create mode 100644 noticeboard/notice_board/doctype/assignto/assignto.json create mode 100644 noticeboard/notice_board/doctype/assignto/assignto.py create mode 100644 noticeboard/notice_board/doctype/notice/notice_row.css create mode 100644 noticeboard/www/notices.html create mode 100644 noticeboard/www/notices.js create mode 100644 noticeboard/www/notices.py create mode 100644 noticeboard/www/user.html create mode 100644 noticeboard/www/user.py diff --git a/noticeboard/notice_board/doctype/assignto/__init__.py b/noticeboard/notice_board/doctype/assignto/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/noticeboard/notice_board/doctype/assignto/assignto.json b/noticeboard/notice_board/doctype/assignto/assignto.json new file mode 100644 index 0000000..10a0cdf --- /dev/null +++ b/noticeboard/notice_board/doctype/assignto/assignto.json @@ -0,0 +1,31 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2023-11-24 16:08:31.361349", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "user" + ], + "fields": [ + { + "fieldname": "user", + "fieldtype": "Link", + "label": "User", + "options": "User" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2023-11-24 16:08:31.361349", + "modified_by": "Administrator", + "module": "Notice Board", + "name": "assignto", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC", + "states": [] +} \ No newline at end of file diff --git a/noticeboard/notice_board/doctype/assignto/assignto.py b/noticeboard/notice_board/doctype/assignto/assignto.py new file mode 100644 index 0000000..a4917ce --- /dev/null +++ b/noticeboard/notice_board/doctype/assignto/assignto.py @@ -0,0 +1,8 @@ +# Copyright (c) 2023, satinderpal singh and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class assignto(Document): + pass diff --git a/noticeboard/notice_board/doctype/notice/notice.js b/noticeboard/notice_board/doctype/notice/notice.js index d984b88..56ce01b 100644 --- a/noticeboard/notice_board/doctype/notice/notice.js +++ b/noticeboard/notice_board/doctype/notice/notice.js @@ -6,3 +6,5 @@ frappe.ui.form.on('notice', { // } }); + + diff --git a/noticeboard/notice_board/doctype/notice/notice.json b/noticeboard/notice_board/doctype/notice/notice.json index 7fd674c..c19a083 100644 --- a/noticeboard/notice_board/doctype/notice/notice.json +++ b/noticeboard/notice_board/doctype/notice/notice.json @@ -19,7 +19,11 @@ { "fieldname": "title", "fieldtype": "Data", + "in_filter": 1, + "in_global_search": 1, "in_list_view": 1, + "in_preview": 1, + "in_standard_filter": 1, "label": "Subject of the notice", "reqd": 1, "unique": 1 @@ -27,7 +31,11 @@ { "fieldname": "description", "fieldtype": "Text Editor", + "in_filter": 1, + "in_global_search": 1, "in_list_view": 1, + "in_preview": 1, + "in_standard_filter": 1, "label": "Body of the notice", "reqd": 1 }, @@ -53,7 +61,7 @@ "index_web_pages_for_search": 1, "is_published_field": "published", "links": [], - "modified": "2023-10-12 16:49:44.032256", + "modified": "2023-11-28 11:28:40.646342", "modified_by": "Administrator", "module": "Notice Board", "name": "notice", @@ -85,7 +93,9 @@ } ], "route": "noticeboard", - "sort_field": "modified", + "search_fields": "title", + "show_name_in_global_search": 1, + "sort_field": "title", "sort_order": "DESC", "states": [], "track_changes": 1, diff --git a/noticeboard/notice_board/doctype/notice/notice.py b/noticeboard/notice_board/doctype/notice/notice.py index 39bf102..7abeb41 100644 --- a/noticeboard/notice_board/doctype/notice/notice.py +++ b/noticeboard/notice_board/doctype/notice/notice.py @@ -6,3 +6,6 @@ class notice(WebsiteGenerator): pass + + + diff --git a/noticeboard/notice_board/doctype/notice/notice_row.css b/noticeboard/notice_board/doctype/notice/notice_row.css new file mode 100644 index 0000000..a6476e5 --- /dev/null +++ b/noticeboard/notice_board/doctype/notice/notice_row.css @@ -0,0 +1,32 @@ +/* notices.css */ + +.notice-container { + border: 1px solid #ddd; + padding: 10px; + margin-bottom: 20px; +} + +.notice-header { + display: flex; + align-items: center; + justify-content: space-between; +} + +.notice-content { + margin-top: 10px; +} + +.notice-title { + font-size: 24px; + margin-bottom: 5px; +} + +.notice-image { + width: 80px; + margin-right: 10px; +} + +.notice-meta { + color: #555; +} + diff --git a/noticeboard/notice_board/doctype/notice/templates/notice_row.html b/noticeboard/notice_board/doctype/notice/templates/notice_row.html index 1dc5cb0..9d0877f 100644 --- a/noticeboard/notice_board/doctype/notice/templates/notice_row.html +++ b/noticeboard/notice_board/doctype/notice/templates/notice_row.html @@ -2,26 +2,70 @@ {% set owner_username = doc.owner %} {% set owner = frappe.get_doc('User', owner_username) %} + + +
+
+

{{ owner.username }} - {{ frappe.format_date(doc.creation) }}

+

Read Notice

+
+
+

{{ owner.username }} {{ doc.title or doc.name }}

+
+
+ {% endblock %} - + diff --git a/noticeboard/www/notices.html b/noticeboard/www/notices.html new file mode 100644 index 0000000..f45cccb --- /dev/null +++ b/noticeboard/www/notices.html @@ -0,0 +1,48 @@ +{% extends "templates/web.html" %} + +{% block title %}{{ _("About Us") }}{% endblock %} + +{% block page_content %} + + + + + Agent is {{ name }} + The car is {{ car }} + {{ _("About Us") }} + +
+ We believe that great companies are driven by excellence, + and add value to both its customers and society. + You will find our team embodies these values. +
+ +
+ {% if notices %} + {% for notice in notices %} +
+

Notice Title: {{ notice.title }}

+

Creation Date: {{ frappe.format_date(notice.creation) }}

+
+ {% endfor %} + {% else %} +

No notices found.

+ {% endif %} +
+ +{% endblock %} + diff --git a/noticeboard/www/notices.js b/noticeboard/www/notices.js new file mode 100644 index 0000000..e939799 --- /dev/null +++ b/noticeboard/www/notices.js @@ -0,0 +1,2 @@ + + diff --git a/noticeboard/www/notices.py b/noticeboard/www/notices.py new file mode 100644 index 0000000..e5baddf --- /dev/null +++ b/noticeboard/www/notices.py @@ -0,0 +1,35 @@ +import frappe + +def get_context(context): + # Fetch the agent information + context.name = 'YourAgentName' + context.car = 'YourCarDetails' + + # Fetch a specific notice (replace 'holiday' with the actual name of your notice) + notice_doc = frappe.get_doc('notice', 'holiday') + owner = frappe.get_doc('User', notice_doc.owner) + + context.doc = { + 'owner': owner.username, + 'creation': notice_doc.creation, + 'title': notice_doc.title, + 'user_image': owner.user_image, + 'route': notice_doc.route, + } + + # Fetch all notices and sort by creation date + notices = frappe.get_all('notice', fields=['owner', 'creation', 'title', 'route'], order_by='creation DESC') + context.notices = [] + + for notice in notices: + owner = frappe.get_doc('User', notice.owner) + context.notices.append({ + 'owner': owner.username, + 'creation': notice.creation, + 'title': notice.title, + 'user_image': owner.user_image, + 'route': notice.route, + }) + + return context + diff --git a/noticeboard/www/user.html b/noticeboard/www/user.html new file mode 100644 index 0000000..7982fd1 --- /dev/null +++ b/noticeboard/www/user.html @@ -0,0 +1,7 @@ +

List of Users

+
    +{% for user in users %} +
  1. {{ user.first_name }} {{ user.get("last_name", "") }}
  2. +{% endfor %} +
+ diff --git a/noticeboard/www/user.py b/noticeboard/www/user.py new file mode 100644 index 0000000..97a6ac4 --- /dev/null +++ b/noticeboard/www/user.py @@ -0,0 +1,4 @@ +import frappe +def get_context(context): + context.users = frappe.get_list("User", fields=["first_name", "last_name"]) + From 323b443b920e0f525600b60f4f00914e1518ac4b Mon Sep 17 00:00:00 2001 From: Baljit998 Date: Thu, 7 Dec 2023 14:54:29 +0530 Subject: [PATCH 2/2] improved css --- .../doctype/notice/templates/notice_row.html | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/noticeboard/notice_board/doctype/notice/templates/notice_row.html b/noticeboard/notice_board/doctype/notice/templates/notice_row.html index 9d0877f..cc0fa36 100644 --- a/noticeboard/notice_board/doctype/notice/templates/notice_row.html +++ b/noticeboard/notice_board/doctype/notice/templates/notice_row.html @@ -6,11 +6,17 @@ /* notice_row.css */ .notice-container { - border: 1px solid #ddd; + border: 1px solid #3498db; border-radius: 10px; padding: 15px; margin-bottom: 20px; - box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); + box-shadow: 0 4px 8px rgba(52, 152, 219, 0.1); + background-color: #fff; + transition: transform 0.3s ease; /* Add a subtle transform on hover */ +} + +.notice-container:hover { + transform: translateY(-5px); /* Lift the notice on hover */ } .notice-header { @@ -24,29 +30,33 @@ } .notice-title { - font-size: 24px; + font-size: 26px; margin-bottom: 10px; + color: #333; } .notice-image { - width: 80px; + width: 60px; + height: 60px; margin-right: 15px; border-radius: 50%; + object-fit: cover; /* Maintain aspect ratio for the image */ } .notice-meta { - color: #555; + color: #777; + font-size: 14px; } /* Style the "Read Notice" button */ .notice-read-button { - background-color: #3498db; + background-color: #3498db; /* Change to blue */ color: #fff; border: none; padding: 10px 15px; border-radius: 5px; cursor: pointer; - transition: background-color 0.3s ease; /* Add smooth transition for color change */ + transition: background-color 0.3s ease, transform 0.2s ease, color 0.3s ease; /* Add smooth transitions for color change, transform, and text color */ } /* Change button color on hover */