Skip to content

Commit

Permalink
able to accesstable vals, trying to figure out how to sort
Browse files Browse the repository at this point in the history
  • Loading branch information
Kell-Stack committed Oct 15, 2019
1 parent 81dd13a commit 927f02a
Show file tree
Hide file tree
Showing 10 changed files with 389 additions and 2,909 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"css-loader": "^3.1.0",
"jquery": "^3.4.1",
"style-loader": "^0.23.1",
"sweetalert2": "^8.18.3",
"url-loader": "^2.1.0"
},
"description": "> Authored by Kelly Sousa, Kinternship 2019",
Expand Down
566 changes: 280 additions & 286 deletions src/bundle/config_bundle.js

Large diffs are not rendered by default.

2,451 changes: 25 additions & 2,426 deletions src/bundle/desktop_bundle.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/bundle/mobile_bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/html/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ <h1> Table Sorting Plugin</h1>
<br>
<br>
<div class="primary">
<h3>Primera Sort</h3>
<h3>Sort</h3>
<div class="dropdown1"></div>
<div class="dropdown2"></div>
</div>

<br>
<br>

<!--
<div class="secondary">
<h3>Segunda Sort</h3>
Expand All @@ -51,7 +51,7 @@ <h3>Texira Sort</h3>
<div class="dropdown6"></div>
</div>
<br>
<br>
<br> -->

</section>

Expand Down
178 changes: 18 additions & 160 deletions src/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
handleSaveButton,
handleCancelButton
} from './saveAndCancel'
import {getRecordData} from './getTableData'
// import {getRecordData} from './getTableData'


(function (PLUGIN_ID) {
Expand Down Expand Up @@ -51,21 +51,25 @@ import {getRecordData} from './getTableData'
}
})
}
})
})
}

var updatedConfig = (config, itemsArr) => {
var items = []
var updatedConfigArr = []
console.log(itemsArr,config, "items array🙀")



}

var getFormLayout = () => {
var connection = new kintoneJSSDK.Connection()
var kintoneApp = new kintoneJSSDK.App(connection)



kintoneApp.getFormLayout(kintone.app.getId(), true).then((rsp) => {
console.log("🥶", rsp)
var config =kintone.plugin.app.getConfig(PLUGIN_ID)
console.log(config,"config💩")

var subTable = getTablesList(rsp)
//console.log("😡", subTable)
// var excluded = excludedFieldTypes(rsp)
Expand Down Expand Up @@ -122,23 +126,6 @@ import {getRecordData} from './getTableData'
.text("Please choose the column from " + event + " you'd like to sort: ")
.append(dropdown1.render());

var dropdown3 = new kintoneUIComponent.Dropdown({
items: JSON.parse(JSON.stringify(tableColumn)),
value: '--------'
})

$('.dropdown3')
.text("Please choose the column from " + event + " you'd like to sort: ")
.append(dropdown3.render());

var dropdown5 = new kintoneUIComponent.Dropdown({
items: JSON.parse(JSON.stringify(tableColumn)),
value: '--------'
})

$('.dropdown5')
.text("Please choose the column from " + event + " you'd like to sort: ")
.append(dropdown5.render());

var dropdown2 = new kintoneUIComponent.Dropdown({
items: [{
Expand All @@ -163,160 +150,31 @@ import {getRecordData} from './getTableData'
$('.dropdown2')
.text("Then the way you'd like to sort the " + event + " column: ")
.append(dropdown2.render());

var dropdown4 = new kintoneUIComponent.Dropdown({
items: [{
label: '--------',
value: '--------',
isDisabled: true
},
{
label: 'Ascending',
value: 'Ascending',
isDisabled: false
},
{
label: 'Descending',
value: 'Descending',
isDisabled: false
}
],
value: '--------'
});

$('.dropdown4')
.text("Then the way you'd like to sort the " + event + " column: ")
.append(dropdown4.render());

var dropdown6 = new kintoneUIComponent.Dropdown({
items: [{
label: '--------',
value: '--------',
isDisabled: true
},
{
label: 'Ascending',
value: 'Ascending',
isDisabled: false
},
{
label: 'Descending',
value: 'Descending',
isDisabled: false
}
],
value: '--------'
});

$('.dropdown6')
.text("Then the way you'd like to sort the " + event + " column: ")
.append(dropdown6.render());
})
//Dropdown Module End#######################################################################################


var record = kintone.app.record.get();
console.log("recs", record);


// kintone.events.on("app.record.create.submit.success", function (ev) {
// var record = ev.record;
// alert("The record ID is " + record["$id"]["value"] + ".");
// });

// var body = {
// "app": [],
// "id": []
// };

// kintone.api(kintone.api.url('/k/admin/app/flow?app=' + kintone.app.getId(), true), 'GET', body, function (resp) {
// // success
// console.log(resp);
// }, function (error) {
// // error
// console.log(error);
// });

// kintone.events.on("app.record.create.submit.success", function (ev) {
// var record = ev.record;
// alert("The record ID is " + record["$id"]["value"] + ".");
// })

// kintone.events.on("app.record.create.submit.success", function (ev) {
// var record = ev.record;
// alert("The record ID is " + record["$id"]["value"] + ".uhh");
// });

// kintone.events.on('app.record.index.edit.submit', function (event) {
// var record = event.record;
// console.log("ok", record)
// console.log("okok", event)
// return event
// })

// var record = kintone.app.record.get();
// console.log(record, "hihbbbu");

// kintone.events.on('app.record.index.show', function (event) {
// console.log(event, "fjbnvkfsk");
// })


// var recordId = kintone.app.record.getId();
// console.log(recordId, "jsfkbksfksk");

// kintone.events.on('app.record.index.edit.change', function (event) {
// console.log("🤖", event)

// })


// var record = kintone.app.record.get();
// console.log(record, "hellohellohelloe");

// // kintone.api('/k/v1/records', 'GET', params).then(function (resp) {

// var recordCreate = kintone.app.record.create
// console.log("🆘🆘", recordCreate);
// var recordEdit = kintone.app.record.edit
// console.log("🆘🆘🆘", recordEdit);
// var recordShow = kintone.app.record.show
// console.log("🆘🆘🆘🆘", recordShow);

// // })


// kintone.events.on('app.record.create.submit', function(event) {
// var record = event.record;
// var params = { app: masterAppId, query: query };

// return kintone.api('/k/v1/records', 'GET', params).then(function(resp) {
// //Check that the company name exists in the master app
// return event;
// }, function(resp) { //Dealing with errors received by the system
// var errmsg = 'There was an error when retrieving the data.';
// if (resp.message) {
// errmsg += '\n' + resp.message;
// }
// alert(errmsg);
// });
// });


// if (config) {
// var parsedConfigObj = JSON.parse(JSON.stringify(config))
// var newConfigObj = updatedConfig(parsedConfigObj)
// console.log(newConfigObj, "🤑")
// }

var saveButton = new kintoneUIComponent.Button({
text: 'Save',
type: 'submit'
});
saveButton.on('click', function () {
handleSaveButton(dropdown)
handleSaveButton()
});

var cancelButton = new kintoneUIComponent.Button({
text: 'Cancel'
});
cancelButton.on('click', function (event) {
handleCancelButton(dropdown)
handleCancelButton()
});

$(".SaveButton").append(saveButton.render())
Expand All @@ -329,6 +187,6 @@ import {getRecordData} from './getTableData'

getFormLayout()

getRecordData()
// getRecordData()

})(kintone.$PLUGIN_ID);
34 changes: 22 additions & 12 deletions src/js/desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,40 @@ import {

// const getLayout = () => {

var connection = new kintoneJSSDK.Connection()
var kintoneApp = new kintoneJSSDK.App(connection)

kintoneApp.getFormLayout(kintone.app.getId(), true).then((rsp) => {
// var config = kintone.plugin.app.getConfig(PLUGIN_ID)
// var connection = new kintoneJSSDK.Connection()
// var kintoneApp = new kintoneJSSDK.App(connection)

// kintoneApp.getFormLayout(kintone.app.getId(), true).then((rsp) => {
// // var config = kintone.plugin.app.getConfig(PLUGIN_ID)


// }).catch((err) => {
// console.log(err);
// });
// }


}).catch((err) => {
console.log(err);
});
// }

console.log("hello kintone from kelly")
kintone.events.on(['app.record.edit.submit', 'app.record.create.submit', 'app.record.detail.show'], function (event) {
console.log("this is the event you were looking for: ", event)

// console.log("skrt skrt", event.record, event.record.Table_0)
var tableNameCheck = (object, value) => {
return Object.keys(object).find(key => object[key] === value)
}
console.log(event.record)

//this will only get you the first instance so maybe write and error code that this plugin will not work if theres more than one table
var tableVals = Object.values(event.record).find(element=> { return element.type === "SUBTABLE"})
var tableName = Object.keys(event.record).find(key => {return event.record[key].type === "SUBTABLE"})
console.log("table VAL ", tableVals)
console.log("test name", tableName)

kintone.events.on(['app.record.edit.submit','app.record.create.submit','app.record.detail.show'], function (event) {
console.log("this is the event you were looking for: ", event)
// filterFunc()
//try reassigning the row thats at index 0 and index 1
//do i need to keep the {id: x, value": y}
var valueArr = []
console.log(tableVals.value, "skkrt")

})

Expand Down
18 changes: 5 additions & 13 deletions src/js/getTableData.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,9 @@ var getTableData = (response) => {

console.log(mostRecentData,"🦜")

if (query ){

}


// if (query ){


// records.forEach(element => {
// console.log(element,"👠👠👠👠👠👠")
// var mostRecentData = element[0]
// console.log(mostRecentData, "recent data")
// }

}

Expand Down Expand Up @@ -57,6 +49,6 @@ var getRecordData = () => {

}

export {
getRecordData
};
// export {
// getRecordData
// };
Loading

0 comments on commit 927f02a

Please sign in to comment.