Browse Source

Initial commit

master
hns 3 years ago
parent
commit
3b77fbe656
  1. 28
      smart_service/masters/doctype/vehi/vehi.js
  2. 10
      smart_service/masters/doctype/vehi/vehi.json
  3. BIN
      smart_service/transactions/doctype/system_mapping/__pycache__/system_mapping.cpython-38.pyc
  4. 19
      smart_service/transactions/doctype/system_mapping/system_mapping.js
  5. 12
      smart_service/transactions/doctype/system_mapping/system_mapping.py

28
smart_service/masters/doctype/vehi/vehi.js

@ -3,7 +3,22 @@
frappe.ui.form.on('Vehi', { frappe.ui.form.on('Vehi', {
refresh: function(frm) { refresh: function(frm) {
}, //var path = "<html><head></head> <body> <div class='buttonIn'> <input type='text' id='enter'></input> <button id='clear'>clear</button> </div>"
var path = "<html><body><div class='attached-file flex justify-between align-center'><div class='ellipsis'><i class='fa fa-paperclip'></i><a class='attached-file-link' target='_blank'></a></div><div><a class='btn btn-xs btn-default' data-action='reload_attachment>${__('Reload File')}</a><a class='btn btn-xs btn-default' data-action='clear_attachment'>${__('Clear')}</a></div></div>)"
var b = "<html> <body> <button id='clear'>Clear"
path = path + "</body></html>";
//console.log("C" + c)
console.log("path" + path)
$(frm.fields_dict.file_path.wrapper).html(path);
console.log(cur_frm.doc.file_path)
//window.addEventListener('load', () => {
// const button = document.querySelector('#clear');
// button.addEventListener('click', () => {
// document.querySelector('#enter').value = "";
// });
//});
},
new_file: function(frm){ new_file: function(frm){
//function open_multi_select_dialog() { //function open_multi_select_dialog() {
//cy.window().its('frappe').then(frappe => { //cy.window().its('frappe').then(frappe => {
@ -21,8 +36,11 @@ frappe.ui.form.on('Vehi', {
onchange: function() { onchange: function() {
var folder = dialog.get_values()['folder']; var folder = dialog.get_values()['folder'];
file_folder = folder file_folder = folder
$("[data-fieldname=file_name]").focus();
$('.form-control[data-fieldname=file_name]').focus();
dialog.refresh() dialog.refresh()
}, },
}, },
{ {
fieldname: 'file_name', fieldname: 'file_name',
@ -57,7 +75,7 @@ frappe.ui.form.on('Vehi', {
//}); //});
//} //}
}, },
/*
clear:function(frm){ clear:function(frm){
var me = this; var me = this;
var file_folder = ''; var file_folder = '';
@ -77,6 +95,7 @@ frappe.ui.form.on('Vehi', {
onchange: function() { onchange: function() {
var folder = dialog.get_values()['folder']; var folder = dialog.get_values()['folder'];
file_folder = folder file_folder = folder
$("[data-fieldname=file_name]").focus();
dialog.refresh() dialog.refresh()
}, },
}, },
@ -102,9 +121,6 @@ frappe.ui.form.on('Vehi', {
}, },
secondary_action: function() { secondary_action: function() {
console.log("secondary"); console.log("secondary");
this.body = $(`<div class="attached-file flex justify-between align-right"></div>`);
//<div class="attached-file flex justify-between align-right">
// </div>
//this.add_files(this.$refs.file_input.files); //this.add_files(this.$refs.file_input.files);
//cy.window().its('frappe').then(frappe => { //cy.window().its('frappe').then(frappe => {
// new frappe.ui.FileUploader(); // new frappe.ui.FileUploader();
@ -119,7 +135,7 @@ frappe.ui.form.on('Vehi', {
dialog.show(); dialog.show();
dialog.refresh(); dialog.refresh();
}, },*/
browse:function(frm){ browse:function(frm){
new frappe.ui.form.MultiSelectDialog({ new frappe.ui.form.MultiSelectDialog({
doctype: "File", doctype: "File",

10
smart_service/masters/doctype/vehi/vehi.json

@ -6,18 +6,24 @@
"editable_grid": 1, "editable_grid": 1,
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"vehicle_name" "vehicle_name",
"path"
], ],
"fields": [ "fields": [
{ {
"fieldname": "vehicle_name", "fieldname": "vehicle_name",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Vehicle Name" "label": "Vehicle Name"
},
{
"fieldname": "path",
"fieldtype": "HTML",
"label": "Path"
} }
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2021-11-19 19:51:22.283760", "modified": "2021-12-29 10:42:02.622951",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Masters", "module": "Masters",
"name": "Vehi", "name": "Vehi",

BIN
smart_service/transactions/doctype/system_mapping/__pycache__/system_mapping.cpython-38.pyc

Binary file not shown.

19
smart_service/transactions/doctype/system_mapping/system_mapping.js

@ -1,8 +1,19 @@
// Copyright (c) 2021, Hard n Soft Technologies Pvt Ltd and contributors // Copyright (c) 2021, Hard n Soft Technologies Pvt Ltd and contributors
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('System Mapping', { /*frappe.ui.form.on('System Mapping', {
// refresh: function(frm) { validate: function(frm) {
frappe.call({
method: "smart_service.transactions.doctype.system_mapping.system_mapping.update_mat",
args: {
"doc": cur_frm.doc.name,
"variant": cur_frm.doc.variant_mapping,
"kilometer": cur_frm.doc.kilometer_mapping
},
callback:function(r){
}
});
// }
}); }
});*/

12
smart_service/transactions/doctype/system_mapping/system_mapping.py

@ -1,8 +1,16 @@
# Copyright (c) 2021, Hard n Soft Technologies Pvt Ltd and contributors # Copyright (c) 2021, Hard n Soft Technologies Pvt Ltd and contributors
# For license information, please see license.txt # For license information, please see license.txt
# import frappe import frappe
from frappe.model.document import Document from frappe.model.document import Document
class SystemMapping(Document): class SystemMapping(Document):
pass def validate(self):
pass
@frappe.whitelist()
def update_mat(doc,variant,kilometer):
self = frappe.get_doc("System Mapping",str(doc))
for item in self.get("system_sub_systems"):
km = frappe.db.sql("""update `tabKilometer Mapping_Items` as km, `tabKilometer Mapping` as kmm set km.mat = %s where km.parent = %s
and km.sub_systems = %s and kmm.variant_mapping = %s
""",(item.mat,str(kilometer),item.sub_systems,self.variant_mapping),as_dict=True)

Loading…
Cancel
Save